How to install PHP on Apache running under Vista

After finally getting Apache running on Vista after some serious brain dramage, I moved on to getting PHP running… certainly better than Apache, but only because of some helpful instructions from others… 

More incredible thanks to:
http://senese.wordpress.com/2007/06/06/install-php-5-under-apache-22-and-windows-vista/#comment-262,

 However, after carefully following the instructions, and reading thru the comments, I still had a big issue: 

I couldn’t get the php test ( phpinfo ) page to come up! I was getting an HTTP 500 error (internal server error) and finally decided to try one of the wierd fixes suggested on the post above. It worked!

Joe Orr’s suggestion to add a backslash to the end of the ini path fixed the problem! Seems kinda lame to me, but change

PHPIniDir “C:\PHP”
to
PHPIniDir “C:\PHP\”

UPDATE:So, it appeared everything was fine after the ending backslash was added… php loaded and I could successfully see the phpinfo page. However, for the next step, when I wanted to get mySQL loaded, it was apparent something was still seriously wrong. When examining the phpinfo page, I could not find the mySQL module loaded (or for that matter, any of the other extensions that should have).

 I carefully looked at the Apache configuration file, and the PHPIniDir was specified correctly as above, and the the php.ini file had the correct entries for mySQL:

extension=php_gd2.dll
extension=php_mysql.dll
extension=php_mysqli.dll

 After some hunting around I found some suggestions to look at the path that php was actually using -

at the very top of the phpinfo page there is an entry for Configuration  File (php.ini) Path. My showed ”C:\Windows”.  Right below it is an entry for “Loaded Configuration File” which also showed C:\Windows. Definitely not good.

Additionally, I checked the entry in the php core section  of the phpinfo page for “extension_dir” and it showed “c:\php5″. Also not good!

The solution? I know this sounds incredulous, but you have to change the Apache config file to have forward slashes!

So rather than use: 
PHPIniDir “c:\php\”

use :

PHPIniDir “c:/php/” 

Even tho the phpinfo page still shows the Configuration File Path to be “c:\windows”, now the Loaded Configuration File correctly showed “c:\php\php.ini”. Also phpinfo now correctly showed the entry for extensions:

 extension_dir c:php\ext.

The good news, now I could see the mySQL module lower down in the phpinfo page, so I knew I was good to go. I still had not loaded mySQL, but at least php would be able to talk to the server when I get it installed!

As a side comment, there was not any discussion in the post I linked to above about why or why not he chose to load the various php modules he did, and I didn’t take a lot of time to check them out. I did not load a few that seemed unnecessary, and it seems to still be working fine, tho its probably a good idea to load what he specified, or look though each one so you know what it is doing. 

Even though I am technical, and have been an on and off programmer for 30 years now, I still just don’t get why software companies (even open source ones) make it so darned ridiculous to get a “standard” configuration running.  Yes, I understand why we need all the great flexibility, but let’s face it, most of us have much better things to do with our time than figure out why a page won’t load because there is no backslash on the end of a configuration line!  (Update: or because in this case you use a forward slash not a backslash!) OK, I’m whining a bit, but I guess I’m due after a whole day just trying to get an Apache web server up and running on Vista…

I thought I would also pass on that I just ran into something called WAMP, which may be worth exploring if you have not yet got your install working, as it is supposed to install Apache/MySQL/PHP onto Windows all at once! Anyone have any experience with this? I’m  a little gun shy at this point after all the time spent (and the fact it is working) to want to chuck it and start over, just to get the mySQL piece. I’ll post on my mySQL experiences if I find that to be a pain too.

Happy installs!

Smitty

Tags: , , , , ,

Leave a Reply