I have been struggling with this for days. I have a windows server 2008 where I have installed Apache 2.2, PHP and MySql. I kept getting the error that mysql_connect was an unknown function, so I followed all guides I could find but with no result. I have now noticed that phpinfo says that php.ini dir is C:\Windows. This is strange since I've written this in httpd.conf:

PHPIniDir 'c:\PHP\'
LoadModule php5_module "c:/PHP/php5apache2_2.dll"
AddHandler application/x-httpd-php .php

How do I get apache and php to read my php.ini and thereby include mysql?


Change your back slashes to forward: PHPIniDir c:/PHP/

| improve this answer | |
  • I have tried: PHPIniDir c:/PHP/, PHPIniDir 'c:/PHP/', PHPIniDir "c:/PHP/". All three variations makes it impossible to start Apache (The Requested operation has failed) – Jesper Mar 20 '12 at 5:01
  • How about CLI afterward? – thinice Mar 20 '12 at 5:07
  • If I start httpd.exe from command line, it says The application has failed to start because MSVCR71.dll was not found, re-installing the application might solve the problem" – Jesper Mar 20 '12 at 5:18
  • ...so I downloaded that dll and installed it and did some tweaking and actually everything works now. I am using this: PHPIniDir "C:/PHP" The solution was to start Apache from Command Line instead of taskbar. Otherwise I would never have found that error. Thanks :) – Jesper Mar 20 '12 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.