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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
tuoxie
Forum Newbie
Posts: 2
Joined: Mon Dec 20, 2010 10:01 pm

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

Post 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!!
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

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

Post by s.dot »

Do you have the mysql extension enabled in php.ini?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
tuoxie
Forum Newbie
Posts: 2
Joined: Mon Dec 20, 2010 10:01 pm

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

Post by tuoxie »

Of course, mysql_connect is working in apache2
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

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

Post 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.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

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

Post 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)?
Post Reply