Page 1 of 1

undefined function mysql_connet(env: MacOSX+php-cgi+nginx)

Posted: Mon Dec 20, 2010 10:24 pm
by tuoxie
First to say, I am in MacOSX 10.6.5 Leapord not any Linux distribution.
Before: apache2 + php + mysql and no fast-cgi, it's OK, mysql_connect no problem.
But i want to use nginx to replace apache2, i use this config (segment) in nginx.conf :

Code: Select all

location ~ \.php {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
and then run "php-cgi -b 127.0.0.1:9000"
yeah, it works. php was called, but mysql is not connected to.
php print the error message:
Fatal error: Call to undefined function mysql_connect() in /Users/.../...php

any guys know the problem ?
Thanks very much!!

Re: undefined function mysql_connet(env: MacOSX+php-cgi+ngin

Posted: Tue Dec 21, 2010 1:13 am
by s.dot
Do you have the mysql extension enabled in php.ini?

Re: undefined function mysql_connet(env: MacOSX+php-cgi+ngin

Posted: Tue Dec 21, 2010 7:45 am
by tuoxie
Of course, mysql_connect is working in apache2

Re: undefined function mysql_connet(env: MacOSX+php-cgi+ngin

Posted: Tue Dec 21, 2010 7:47 am
by Darhazer
tuoxie wrote:Of course, mysql_connect is working in apache2
They can use different php.ini files. Run phpinfo() via nginx to check what php.ini is used.

Re: undefined function mysql_connet(env: MacOSX+php-cgi+ngin

Posted: Tue Dec 21, 2010 9:22 am
by Weirdan
What is your php version (this could be important because php-fpm is in the PHP core since 5.3.3, and it uses a bit different config format)?