How to Install PHP 5.3 on Windows

Share this article

PHP5.3 on Windows
With 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?

Frequently Asked Questions about Installing PHP 5.3 on Windows

Why am I getting an error message during the PHP 5.3 installation process on Windows?

There could be several reasons why you’re encountering an error during the installation process. One common issue is not having the correct version of Visual C++ Redistributable installed. PHP 5.3 requires Visual C++ Redistributable for Visual Studio 2008. If you have a different version installed, you may encounter errors. Download and install the correct version and try the installation process again.

How can I verify if PHP 5.3 has been installed correctly on my Windows system?

After you’ve completed the installation process, you can verify if PHP 5.3 has been installed correctly by opening the Command Prompt and typing “php -v”. This command will display the version of PHP that is currently installed on your system. If PHP 5.3 has been installed correctly, you should see “PHP 5.3” displayed.

Why isn’t PHP 5.3 working with my web server?

If PHP 5.3 isn’t working with your web server, it’s likely that the PHP module hasn’t been enabled in your web server’s configuration file. For Apache, you’ll need to edit the httpd.conf file and uncomment the line that loads the PHP module. For IIS, you’ll need to add the PHP handler in the IIS Manager.

Can I install PHP 5.3 on a 64-bit Windows system?

Yes, you can install PHP 5.3 on a 64-bit Windows system. However, you should note that PHP 5.3 is only available in 32-bit binaries for Windows. This means that you’ll need to install the 32-bit version of Visual C++ Redistributable for Visual Studio 2008, even if you’re using a 64-bit system.

How can I upgrade from PHP 5.2 to PHP 5.3 on Windows?

To upgrade from PHP 5.2 to PHP 5.3, you’ll first need to uninstall PHP 5.2. After you’ve uninstalled PHP 5.2, you can then proceed with the installation process for PHP 5.3. Remember to backup any important files before you begin the uninstallation process.

Why am I getting a “php5ts.dll was not found” error?

This error usually occurs when the PHP installation directory is not in the system’s PATH environment variable. To resolve this issue, you’ll need to add the PHP installation directory to the PATH environment variable. You can do this by editing the system’s environment variables in the System Properties.

Can I install PHP 5.3 without having administrator privileges on Windows?

No, you cannot install PHP 5.3 without having administrator privileges. The installation process requires access to system directories and the Windows Registry, which requires administrator privileges.

How can I configure PHP 5.3 to work with MySQL on Windows?

To configure PHP 5.3 to work with MySQL, you’ll need to edit the php.ini file and uncomment the lines that load the MySQL extensions. You’ll also need to ensure that the MySQL server is running and that PHP can connect to it.

Why am I getting a “Unable to load dynamic library” error?

This error usually occurs when PHP cannot find the extension DLLs. To resolve this issue, you’ll need to ensure that the extension_dir directive in the php.ini file is set to the correct directory.

Can I install multiple versions of PHP on the same Windows system?

Yes, you can install multiple versions of PHP on the same Windows system. However, you’ll need to configure your web server to use the correct version of PHP for each website or application. This can be done by editing the web server’s configuration file.

Craig BucklerCraig Buckler
View Author

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form