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.

  1. 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.

  2. 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

    Screenshot of new PHP directory in Windows 7
    New PHP Directory
  3. 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.

    Screenshot of new PHP files after being extracted from zip file
    Extract PHP Files
  4. 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.

    Screenshot of php.ini, phpForApache.ini and wampserver.conf files inside PHP directory
    Copy Configuration Files
  5. 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.

  6. 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.

    Screenshot of active PHP settings in WAMP
    Active PHP Settings

    Screenshot of active PHP extensions in WAMP
    Active PHP Extensions
  7. Open your php.ini file in WAMP and create a backup of this file.

    Screenshot of php.ini file in WAMP menu
    WAMP php.ini File
  8. Exit WAMP entirely and restart it.

    Screenshot of Exit option in WAMP menu
    Exit WAMP
  9. Once WAMP has restarted, select the option to Stop All Services.

    Screenshot of stopping all services menu option in WAMP
    Stop All Services
  10. With all services stopped, select the version of PHP that you wish to run from the PHP Version menu in WAMP.

    Screenshot of PHP version in WAMP menu
    WAMP PHP Version
  11. 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.

  12. 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 =

      Screenshot of file comparison showing the error_log directive
      Error Log Directory
    • Specify the PHP extensions directory: extension_dir =

      Screenshot of file comparison showing the extension_dir directive
      Extensions Directory
    • Specify the PHP upload directory and max upload file size: upload_tmp_dir = and upload_max_filesize =

      Screenshot of file comparison showing the upload_tmp_dir and upload_max_filesize directive
      File Upload Settings
    • Specify the PHP timezone: date.timezone =

      Screenshot of file comparison showing the date.timezone directive
      Timezone Setting
    • Specify your PHP session path: session.save_path =

      Screenshot of file comparison showing the session.save_path directive
      Session Path
  13. 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

    Screenshot of file comparison showing my PHP custom configuration settings
    Custom Configuration Settings

    Screenshot of file comparison showing my PHP custom configuration settings
    Custom Configuration Settings (continued)
  14. 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!

    Screenshot of the WAMP menu option to restart all services
    Restart All Services

As Jordan points out in the comments below, you’ll want to update PHP’s location in your Windows Path Variable (links to a post I wrote) following a PHP upgrade.

Posted by: John Dugan