Upgrading to PHP 5.3 - an easy way
I already talked about how WPI can help you installing PHP on Windows running IIS. If you haven't read that post, I would encourage you to read that post before continue reading this. The link is here. So wondering why I am asking you to read the previous post of mine. Well the reason is we are going to upgrade to PHP 5.3 following my previous post and then doing a little bit of trick. Again I have seen a lot of forum posting in the IIS forum where people have asked about this. I would again ensure that manual steps are extremely limited and that most of the process is done by the software.
If you already have any version of PHP running (greater than PHP5.2.8) with IIS FastCGI please ignore this paragraph. Otherwise install the latest version of PHP 5.2.11 using Microsoft Web Platform Installer as described in my previous blog. Once your PHP environment is set properly please follow the next paragraph. A quick and easy way to test the PHP installation is to write a small PHP script (name it anything you want, I am naming it index.php) and have <?php phpinfo() ?> as a content in the file. You can save this file in your WEBROOT folder and access it using browser of your choice.
In order to test PHP installation on IIS I generally do the below:
- Go to DOCUMENT_ROOT (typically this will be C:\Inetpub\wwwroot) and create a folder named 'phptest'.
- Save the above file with name index.php inside the folder 'phptest'.
- Please ensure that you have a site named 'Default Web Site' present and the physical path is pointing to 'C:\Inetpub\wwwroot' and the port binding is default 80 port. When you enable/install IIS by default this is created so unless you have deleted it yourself, it should be there.
- Now invoke Internet Explorer and type 'http://localhost/phptest/' in the address bar.
- If you are able to see a proper page full with PHP information, you are all set.
If you would like to move to PHP5.3 now I would strongly advise to go through the migration guide at http://us.php.net/migration53. This details out all the differences. new features etc. Windows binaries for PHP5.3 are available at http://windows.php.net/download/. I would advise to do the following:
- Understand thoroughly the need for PHP5.3
- Go to Control Panel/Add Remove Programs and uninstall PHP5.2.11
- Download the MSI for 5.3 from http://windows.php.net/download/. There are certain advantages of using the MSI as it automatically does some configuration setting for you. So I would suggest to use the MSI. Ensure that you are downloading the NTS version of PHP MSI. At a top level MSI will do the below things automatically if you have selected IIS FastCGI to be configured from the install UI:
- Do the handler mapping for *.php files
- Add 'index.php' to default document set
- Set some of the INI directives for you in PHP.INI file which is considered as a good practice
- At install time select all the extensions you would like to use.
- Install PHP 5.3.
- One of the changes in 5.3 is related to timezone where if PHP INI directive date.timezone is not set, PHP will issue you a warning. Please set it to something you would like the default to be to get rid of this warning in your PHP.INI file. A list of supported timezone can be found at http://us3.php.net/manual/en/timezones.php.
Hope this helps you run PHP5.3. And thanks for the patient reading.
Now that you know how to configure and test PHP installation under IIS, let us focus on some cool PHP programming tips. Next week I am planning to talk about writing a basic authentication page using PHP. Till then good bye.
Don Raman