如何使用MacPorts添加MySQL对PHP的支持? [英] How to add MySQL support for PHP using MacPorts?

查看:93
本文介绍了如何使用MacPorts添加MySQL对PHP的支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过MacPorts安装了php 5.3,现在我尝试连接到数据库(MySQL)
但是总是在我尝试调用mysql_connect()时;即时通讯出现错误:

I installed php 5.3 through MacPorts and now i tried to connect to a database (MySQL)
but always when i'm trying to call mysql_connect(); im getting an error:

Call to undefined function mysql_connect() 

我的设置是:

  • 豹10.5.7

通过Macports安装和运行的软件包可能与此问题有关:

  • php5 @ 5.3.0_2 + apache2 + macosx + pear
  • php5-mysql @ 5.3.0_0 + mysql5
  • mysql5 @ 5.0.85_0

我知道在没有mysql支持的情况下编译php时会出现此错误 但是php5-mysql软件包应该将此支持添加到php中.

I know that this error appears when php is compiled without mysql support but the package php5-mysql should add this support to php.

我真的不知道该怎么办.
我尝试了很多可能的配置,但没有一个起作用.

I really dont know what i can do.
I tried so many possible configurations but none of them worked.

推荐答案

在撰写问题时,我找到了一个解决方案,所以它可能对其他任何人都有用:

Just at the moment of writing my question I found a solution so maybe it's useful to anyone else:

通过macports安装php 5.3的问题是php.ini中有一行错了.

The problem with the php 5.3 installation via macports is that there is a line in the php.ini thats wrong.

; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"

应更改为:

; Directory in which the loadable extensions (modules) reside.
; extension_dir = "./"

(只需取消注释,对吧.)

(just uncomment it, right.)

PHP 5.3会找到extension_dir本身,因此不再需要extension_dir.

PHP 5.3 finds the extension_dir itself so there is no need for extension_dir anymore.

这篇关于如何使用MacPorts添加MySQL对PHP的支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆