Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Can not connect via php to mysql with mod_fcgid under Vista |
|
Author |
|
sergdev
Joined: 27 Feb 2010 Posts: 1
|
Posted: Sat 27 Feb '10 21:32 Post subject: Can not connect via php to mysql with mod_fcgid under Vista |
|
|
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?
To check mysql connection I use the following php code:
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:
Quote: | 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
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...
I obtain the following warning:
Warning: mysql_connect() [function.mysql-connect]: in E:\ ... \testphp\mysql.php on line 7
Error log of mysql contain no any errors on `mysql_connect()`.
Thanks in advance! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 11 Mar '10 20:12 Post subject: |
|
|
You also need to add the PHP path to the %PATH%
DefaultInitEnv PATH "x:/xxxxx/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
DefaultInitEnv SystemRoot "C:/Windows"
DefaultInitEnv SystemDrive "C:"
DefaultInitEnv TEMP "C:/WINDOWS/Temp"
DefaultInitEnv TMP "C:/WINDOWS/Temp"
DefaultInitEnv windir "C:/WINDOWS"
Where xxxx points to you php dir. |
|
Back to top |
|
|
|
|
|
|