How to Update to PHP 8 in WAMP Server Localhost

Since PHP version 8 has been released recently and you as a developer want to put your hands on to the exiting journey of PHP version 8, you must be wondering how to upgrade to PHP 8 in WAMP server. This article with a YouTube video will guide you to update WAMP server to PHP version 8.

Read our blog on How to configure PHP 7 on WAMP server in localhost and watch the YouTube video on how to update PHP 7 in WAMP Server.

As you can understand, You can use PHP 5, PHP 7, PHP 8 in a single WAMP installation. Also you can use multiple version of PHP of same release like PHP 7.2 and PHP 7.4 within the same WAMP server installation. This is a nice way to work on multiple PHP version and you just have to select the needed PHP version in WAMP.

Please note that PHP 8 requires Apache 2.4.x. I have Apache 2.4.9 installed with WAMP v2.5. Now as a prerequisite, first you need to install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019. Download and install both the x86 and x64 version of the file from here. If you are using 32 bit OS, then download 32 bit package only. If you have 64 bit OS, then I recommend to install both 32-bit as well as 64-bit packages.

Once all this done, then we are ready to install/configure PHP 8 in local machine.

Watch this video from YouTube or follow the steps mentioned below to update PHP version to PHP 8 in WAMP Server.

Step 0:

Download the PHP 8 zip version from the PHP Download site for Windows. Choose the x64 Thread Safe version if you have 64bit Windows. As of now PHP 8.0.1 is available so I have downloaded PHP 8.0(8.0.1).

Step 1:

Locate to your WAMP directory, (usually C:/wamp). Go to C:/wamp/bin/php and create a new folder “php8.0.1″ and extract the content of downloaded php .zip file here.

Step 2:

Now, navigate to your old PHP folder. (mine is php7.1.10), and copy wampserver.conf from old and paste it to your “php8.0.1″ folder.

Step 3:

Now, go to C:/wamp/bin/php/php8.0.1 folder and locate file php.ini-development. Copy it and rename to php.ini in the same directory.

Open the newly renamed php.ini file and update the following values:

extension_dir = C:/wamp/bin/php/php8.0.1/ext
upload_tmp_dir = C:/wamp/tmp
error_log = C:/wamp/tmp

Make sure to put the correct path in the extension_dir.

Now, scroll down to extension list and choose the appropriate extensions needed by you. I have put the below values:

extension=bz2
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
; Must be after mbstring as it depends on it
extension=exif
extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=oci8_19  ; Use with Oracle Database 19 Instant Client
extension=odbc
extension=openssl
extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop

Save and close the file.

Step 4:

Now, make a duplicate of php.ini file and save it as phpForApache.ini. This file is needed by Apache web server.

Step 5:

Now open wampserver.conf copied in C:/wamp/bin/php/php8.0.1/ directory in Step 2 above. Modify it so that it should look like below:

<?php

$phpConf['phpIniDir'] = '.';
$phpConf['phpExeDir'] = '.';
$phpConf['phpConfFile'] = 'php.ini';

$phpConf['apache']['2.2']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.2']['LoadModuleFile'] = 'php5apache2_2.dll';
$phpConf['apache']['2.2']['AddModule'] =  '';

$phpConf['apache']['2.4']['LoadModuleName'] = 'php_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php8apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] =  '';

?>

Note that the LoadModuleName for PHP 8 is php_module and LoadModuleFile for PHP 8 is php8apache2_4.dll . 

Step 6:

Start WAMP server and go to PHP >> PHP Version and there you will find version 8.0.1 and select it.

Step 7:

Open your localhost in any browser and go to PHP Info link. You will see that the PHP version is now updated to PHP 8.

Final suggestion: It is better to include the new path in your system path directory otherwise you may face some issues with you CURL extension. Go to Windows environment variable window and edit system variable "Path" to add a new string "C:\wamp\bin\php\php8.0.1;". This step will resolve the CURL error "Unable to load dynamic library 'php_curl.dll' - The specified module could not be found in Unknown on line 0"

Wish you happy coding with PHP 8.

Comments