Thursday, January 31, 2013

Apach2 2.4 load php.ini bug

I installed Apache2.4 and PHP 5.4. When attempting to connect to Mysql a fatal error message is returned:
Call to undefined function mysqliconnect()
Calling phpinfo(); shows that :
Configuration File (php.ini) Path = C:\Windows
Loaded Configuration File = (none)
I do have php.ini.  In Windows command prompt, typed "php -i |more" and I do see
"Loaded Configuration File =C:\php\php.ini"
I finally find the bug. In Apache httpd.conf, change
PHPIniDir "C:\php\"
LoadModule php5_module "C:\php\php5apache2_4.dll"

PHPIniDir "C:/php/"
LoadModule php5_module "C:/php/php5apache2_4.dll"

"\" for file and directory are OK for Apache 2.2, but not OK for Apache 2.4. We have to use "/" for file and directory in Apache 2.4. Also modify php.ini
php.ini, line 880 change
line 810 add (assume php is install in C:\php\):
extension_dir = "C:\php\ext"

No comments:

Post a Comment