Way to Upgrade PHP in WAMP

Way to Upgrade PHP in WAMP

Way to Upgrade PHP in WAMP

One of the great things about WAMP is that it allows you to easily switch between different versions of PHP. All you need to do is properly install the different versions of PHP for your machine. Here is how it’s done.

I recently upgraded to Windows 10 and took the opportunity to record a screencast on changing my PHP version in WAMP. The screencast, based on WAMP 2.5, is meant to compliment the steps below that are based on WAMP 2.2. I recommend that you read through the steps, watch the screencast, then come back to steps as you upgrade PHP on your version of WAMP.

Download the zip file for the version of PHP for Windows that you wish to install.

Make sure that you download the correct Thread Safe version — either VC9 or VC11.

The VC9 builds require you to have the Visual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installed. The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed.

Create a new folder in [path-to-wamp]/bin/php/php.#.#.# where [path-to-wamp] is the location that WAMP is installed on your machine and #.#.# corresponds to the version that you are installing, ie: c:/wamp/bin/php/php5.4.29

New PHP Directory

Extract the all files from your download to the new PHP directory you created in the previous step. That list of files should look similar to the ones captured in the screenshot below.

Extract PHP Files

Copy the following files from your old PHP directory to your new PHP directory.

php.ini

phpForApache.ini

wampserver.conf

These files contain your PHP, Apache and WAMP configurations.

IMG 258

Copy Configuration Files

Open the php.ini and phpForApache.ini files in your new PHP directory that you copied in the previous step. Search for any references to your old PHP version and replace them with the new PHP version. You will for sure need to update the extension_dir path. Depending on what PHP extensions you have installed, you may need to update others as well.

Start WAMP (if it’s not already started) and take note of all the active PHP settings and extensions that you are currently running. You will need this information in a future step.

Active PHP Settings
Active PHP Extensions

Open your php.ini file in WAMP and create a backup of this file.

IMG 261WAMP php.ini File

Exit WAMP entirely and restart it.

Exit WAMP

Once WAMP has restarted, select the option to Stop All Services.

Stop All Services

With all services stopped, select the version of PHP that you wish to run from the PHP Version menu in WAMP.

IMG 264WAMP PHP Version

Verify that all PHP settings and extensions are enabled from step 6. Note, there may be a few differences in the available settings and extensions in your new version of PHP.

Open up the php.ini file in WAMP and add all required PHP configuration settings that are present in the php.ini backup file that you created in step 7. The easiest way to identify missing configuration settings is to run a diff between your backup php.ini file from step 6 and your new php.ini file using a tool like DiffNow.

While everyone’s PHP configuration is slightly different, below are a few required configuration settings that must be updated.

Specify the PHP error log directory: error_log =

Error Log Directory

Specify the PHP extensions directory: extension_dir =

IMG 266

Extensions Directory

Specify the PHP upload directory and max upload file size: upload_tmp_dir = and upload_max_filesize =

IMG 267

File Upload Settings

Specify the PHP timezone: date.timezone =

IMG 268Timezone Setting

Specify your PHP session path: session.save_path =

Session Path

Update any custom configuration settings from your php.ini backup file created in step 7 – again by running a diff. I work alot in Magento and explained in another post some of my PHP configuration for importing large databases in WAMP. Below are those values.

max_execution_time = 5000

max_input_time = 5000

memory_limit = 1000M

post_max_size = 750M

Custom Configuration Settings
Custom Configuration Settings (continued)

Lastly, Restart All Services in WAMP for your new PHP configuration to take effect. …And give yourself a pat on the back, PHP in WAMP has been successfully upgraded!

Restart All Services