Changes in PHP 5.3
Setup: Windows 7, IIS 7, PHP 5.3.3, MySQL 5.0
If you don’t want to read my “blabbering” about how I encountered the errors and how I got the resolution, you can just go to: Installing/configuring PHP 5.3 on Windows 7/IIS 7
I reformatted my laptop months ago and had just decided to install php/mysql again. No sweat. I’ve done this several times. I even created a documentation for it. But somehow Loaded Configuration File in phpinfo() is empty. I didn’t miss a step in my documentation. So I consulted Mr.Google. Hours after…still no luck. I kept getting one error after another. Even narrowing the search to just PHP 5.3 and a specific IIS/OS version didn’t help. What has also thrown me off-track is that I have php 5.3 on another machine (I’ve set this up early this year) and it’s working.
By this time I’ve found out that:
» timezone is needed in this version
» ISAPI is no longer supported so my documentation, which is for php 5.2+ and ISAPI on IIS, is pretty much useless
» php5isapi.dll and php5nsapi.dll are no longer included in 5.3 which makes sense since these are used for ISAPI (if you don’t know #2, then you’ll probably waste some time figuring out why these dlls are not bundled with 5.3)
After several hours of going through links and uninstalling/reinstalling PHP, phpinfo() wasn’t even showing anymore. I was getting the error below:
PHP Warning: phpinfo() [<a href='function.phpinfo'>function.phpinfo</a>]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘-8.0/no DST’ instead in F:\phpinfo\phpinfo.php on line 7
I added date_default_timezone_set(’America/Los_Angeles’); just before phpinfo() and finally Loaded Configuration File is now showing as C:\PHP\php.ini!!!
My problem didn’t stop here. While trying to install Wordpress 3.0 (I’ve only done this on windows XP before), I encountered the popular and dreaded message:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress
I rechecked phpinfo() and mySQL is nowhere to be found. After several hours of googling again (I’m starting to feel like a complete idiot for not being able to resolve this after going through so many links) , I found out that extension_dir in php.ini should now just be “ext” instead of “C:\Php\ext”! Somehow nobody mentioned this change in their “instruction” on PHP5.3 — except for this good Samaritan (I’m pretty sure he learned this the hard way too).
Okay. So PHP and MySQL are now communicating. Back to WP3. I run http://localhost/blog/wp-admin/install.php and it runs for a couple of minutes and then… nothing. White screen. I modified install.php and commented out everything and typed in echo ‘hello world’; and I’m able to see it on the browser so it means php is running. So I figured it has to be an issue with WP3. Google seem to suggest this also but all the solutions that people said have resolved their white screen of death issue didn’t work for me. What gives? I decided to give it a rest.
2 days after, I decided to just work on a personal php project (miiBlog) that I’ve been working on early this year (and never got around to finalize it) instead of troubleshooting WP 3.0. I’ve restored miiBlog database and re-created an application for it on IIS. http://localhost/miiBlog runs for a couple of minutes and then nothing. Holy sh*t. It’s not a WP issue afterall??? Now I feel really stupid. I’m thinking this shouldn’t be too hard to troubleshoot because this is my code after all and I know for a fact that this used to work before I reformatted my laptop. I narrowed it down to mysql_connect. I figured, if it has something to do with connection then it should throw an error because my code is designed to catch/throw a connection error. WTH. * * lightbulb * * I remembered I’ve placed a code at the beginning of my page to hide errors (eg: error_reporting(0);) . I commented it out and voila! I finally got an error message!
Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in F:\lostgirlwondering\miiblog\index.php on line 2
Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. F:\lostgirlwondering\miiblog\index.php on line 2
Fatal error: Maximum execution time of 60 seconds exceeded in F:\lostgirlwondering\miiblog\index.php on line 2
This time, it only took a couple of minutes to zero in on a link/solution:
Either change localhost to 127.0.0.1 on mysql_connect, or go to C:/Windows/System32/drivers/etc, open up host and change (uncomment) # 127.0.0.1 localhost to 127.0.0.1 localhost. Yipeee!!!
This link says it’s a windows 7 configuration and not a PHP 5 or WP3 issue. However, I’ve set up miiBlog on Windows 7 before and was using localhost without any issue. I never had to modify the host file. Could it be due to some of the windows update? After all, it’s been several months since I’ve last tested miiBlog. Whatever the reason is for the change, I’m thrilled that everything’s working now. I went back to WP3, installed it, and was able to create a custom theme (finally!).
I guess watching 2 seasons of the Challenge helped clear up my mind

@ 11:31 pm | Uncategorized
Installing/configuring PHP 5.3 on Windows 7/IIS 7
Setup: Windows 7, IIS 7, PHP 5.3.3, MySQL 5.0
This is assuming you already have mySQL installed and IIS up and running with CGI enabled.
1. Download PHP (5.3.3 is the latest for now) here. Make sure you download the zip file under Binaries
2. Create a folder called PHP (you can name it however you want) under C (or any drive), and unzip the contents. Under C:\PHP, rename php.ini-development to php.ini
3. Open php.ini and make the following changes (removing the ; at the front means you’re un-commenting it):
;Extension_dir to extension_dir = “ext” – this will tell php where the extensions are
;extension=php_mysql.dll to extension=php_mysql.dll – this means php will load this mysql extension
;date.timezone to date.timezone=”America/Los_Angeles” – this is a must in php 5.3. You can get your timezone string from here
4. On IIS (start > run, type inetmgr), go to Default Web Site and double click on Handler Mappings
5. Click on Add Module Mapping.. on the right side of the screen
6. Enter the following in the Edit Module Mapping
Request path: *.php
Module: FastCgiModule
Executable: C:\Php\php-cgi.exe (or wherever you unzipped your php)
Name: PhpFastCgi
7. Open MySQL folder and copy libmysql.dllto C:\Windows folder. This is needed by MySQL
8. Now you need to verify that php is working. Go to your localhost folder location (C:\inetpub\wwwrooot in my case) and create phpinfo.php with the following content
phpinfo();
9. Open your browser and point it to http://localhost/phpinfo.php. The phpinfo screen should appear. Take note that Loaded Configuration file should not be empty, and if you’re planning to use mySQL (or any dabatase) then it should also appear on the config page.
10. If for some reason you’re getting the error below when you run phpinfo.php
PHP Warning: phpinfo() [<a href='function.phpinfo'>function.phpinfo</a>]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘-8.0/no DST’ instead in F:\phpinfo\phpinfo.php on line 7
then change the content of phpinfo.php to:
date_default_timezone_set(’America/Los_Angeles’);
phpinfo();
11. Here’s a screen shot of phpinfo showing my Loaded Configuration file and mySQL

And that’s it!
