I have compiled PHP 5.3.6 from source on Mac OS X 10.6 using the --with-mysqli=mysqlnd option. The output of both php -m and php-cgi -m show the mysqli and mysqlnd modules. When I run a simple test PHP file containing a mysql_connect(...) using the regular php binary, it connects fine. When I use the same test PHP file with php-cgi, I get:
PHP Fatal error: Call to undefined function mysql_connect() in /Users/chris/test2.php on line 2
I've confirmed that the MySQL socket information is correct in php.ini and have ensured that php-cgi is using that file using the -c argument. MySQL works fine using the regular mysql command line interface and obviously is working with regular PHP. phpinfo() from php-cgi shows correct versions of mysqli & mysqlnd libraries.
I need to run PHP in a CGI configuration in this particular environment so I really need php-cgi to work. I am not worried about Apache2/nginx/etc at this point - just getting CGI to work. Any advice on what I am missing?