How to add MySQL support for PHP using MacPorts?

核能气质少年 提交于 2019-12-25 04:35:10

问题


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() 

My setup is:

  • Leopard 10.5.7

Installed and active packages via Macports that may be related to this problem:

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

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.


回答1:


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

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 = "./"

should be changed to:

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

(just uncomment it, right.)

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



来源:https://stackoverflow.com/questions/1516739/how-to-add-mysql-support-for-php-using-macports

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!