Programming
Article
By Craig Buckler

How to Install PHP 5.3 on Windows

By Craig Buckler

PHP5.3 on WindowsWith all the excitement surrounding Firefox 3.5, it may have escaped your attention that PHP 5.3 has also been released. This is the most significant update since version 5.0 and several features that were originally scheduled for version 6.0 have been slipped into the build. You’ll be hearing about these on SitePoint soon but, first, we need to install PHP 5.3 on our Windows development systems.

A Word of Warning…

PHP 5.3 is new and you may experience some problems (see below). If you already have a stable PHP environment, ensure you keep a backup of your current php folder and settings.

Web Server Installation

If you have not installed Apache, refer to How to Install Apache Web Server on Windows. Optionally, you can also install the MySQL database — refer to How to Install MySQL.

PHP 5.3 Installation

Windows PHP distributions are now available from a dedicated microsite at http://windows.php.net/download/. The choice is a little bewildering and the instructions are vague but, since we will be installing PHP as an Apache 2.2 module using the Apache Lounge build, so you should download the VC9 x86 Thread Safe Zip file.

General note:
Download the VC6 builds if you are using the standard Apache.org web server. The VC9 builds should be used for the Apache Lounge binaries or IIS.

A Thread Safe version should be used if you install PHP as an Apache module. The Non Thread Safe version should be used if you install PHP as a CGI binary.

You can now follow the instructions at How to Install PHP on Windows from step 2 onwards. Note that, in step 3, php.ini-recommended is now named php.ini-development; you still need make a copy and rename it php.ini.

If you have previously defined a working PHP configuration file, a tool such as WinMerge can help you compare and copy existing values to your new php.ini file.

PHP 5.3 Error Reporting

The first time you load your previously bug-free PHP application, you are likely to be confronted by reams of long-winded error messages. Don’t panic! PHP 5.3 introduces a number of new error directives which are enabled by default in the development php.ini configuration:

  • E_STRICT suggests improvements that ensure best interoperability and forward compatibility of your code, and
  • E_DEPRECATED warns you about code that will not work in future versions of PHP.

Very useful. In my experience, the majority of messages report that a time zone has not been defined and assigning a return values using new by reference is deprecated.

Unfortunately, applications can display so many minor errors they become impossible to use. You can disable the new error directives by setting the error_reporting value to "E_ALL & ~E_DEPRECATED" on line 514 of php.ini and restarting Apache.

However, several web applications, including WordPress, define their own error_reporting settings and may continue to show messages. It will take a developers some time to upgrade their applications to full PHP 5.3 compatibility.

Have you installed PHP 5.3 successfully? Have you experienced any major issues or problems with existing code?

Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account