I configured PHP to use Apache mod_fcgid. PHP is working, but after changes in configuration I am not able to connect to mysql via php. How to fix this? Any ideas, which can hint me, are very desired!
To check mysql connection I use the following php code:
error_reporting(E_ALL);
$link = mysql_connect('127.0.0.1', 'root', 'password_here');
if (!$link) {
die('Could not connect. Error message: <' . mysql_error() . '>');
}
echo 'Connected successfully';
Error message returned by mysql_error()
is empty.
I use the following configuration in Apache:
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
AddHandler fcgid-script .fcgi .php
DefaultInitEnv PHPRC "C:/Program Files/php5"
DefaultInitEnv PHP_FCGI_MAX_REQUESTS 1000
MaxRequestsPerProcess 1000
MaxProcessCount 15
IPCCommTimeout 120
IdleTimeout 120
FCGIWrapper "C:/PROGRA~1/php5/php-cgi.exe" .php
AddType application/x-httpd-php .php
DefaultInitEnv PATH "C:/PROGRA~1/MYSQL/MYSQLS~1.0/LIB/OPT;C:/PROGRA~1/APACHE~1/APACHE2.2/BIN;C:/WINDOWS/system32;C:/WINDOWS"
</IfModule>
PHP 5.3.1, Apache/2.2.14 (Win32), MySQL 5.0.67-community-nt, Windows Vista Home Premium Service Pack 1. I downloaded binaries of mod_fcgid from http://www.apachelounge.com/download/mods/mod_fcgid-2.2b-w32.zip
EDIT:
I used phpinfo()
to compare configuration. "Loaded Configuration File
" is the same for both with and without mod_fcgid
. mysql
section is the same for both configs. What I found out that Environment section when mod_fcgid is turned on contains only FastCGI related variable (4 items only), while without mod_fcgid - much more...
If you need more info please let me know.
If somebody has successful installation of FastCGI for php, with Apache and mysql on Windows it could be very good to know about your experience.
EDIT:
I obtain the following warning:
Warning: mysql_connect() [function.mysql-connect]: in E:\ ... \testphp\mysql.php on line 7
EDIT
Error log of mysql contain no any errors on mysql_connect()
.