Saturday, June 16, 2018

How to upgrade PHP 7.2.6 on WAMP 3.0.6 server?

Software Required
- WAMP 3.0.6
- PHP 7.2.6

In the development stage, upgrading of PHP to support new library or functionality is unavoidable. WAMP has been used for my project development, however, PHP 7.2.6 doesn't exists in the WAMP 3.0.6. Below are the steps that I performed to import PHP interpreter into my WAMP container.

PHP installation steps
  • Download PHP from https://windows.php.net/download#php-7.2
  • Unzip the PHP zip file into "php7.2.6" folder and copy into "D:\wamp64\bin\php" folder.
  • Copy wampserver.conf from "D:\wamp64\bin\php\php5.6.25" to "D:\wamp64\bin\php\php7.2.6"
  • Browse to "D:\wamp64\bin\php\php7.2.6" folder, rename "php.ini-development" to "php.ini.
  • Alter php.ini by changing the new configuration as shown below
extension_dir = "d:/wamp64/bin/php/php7.2.6/ext"
upload_tmp_dir ="d:/wamp64/tmp"
error_log ="d:/wamp64/logs/php_error.log"
  • Alter the extension section at php.ini 
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
;extension=php_odbc.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll

; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll

extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_com_dotnet.dll
;extension=php_dba.dll
;extension=php_enchant.dll
;extension=php_ftp.dll
;extension=php_phpdbg_webhelper.dll
;extension=php_sodium.dll
;extension=php_sysvshm.dll
;extension=php_zend_test.dll
  • Duplicate php.ini file and save it as phpForApache.ini.
  • Alter wampserver.conf located at "D:\wamp64\bin\php\php7.2.6" folder
$phpConf['apache']['2.4']['LoadModuleName'] = 'php7_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php7apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] =  '';
  • Launch wampserver manager, browse to "PHP" > "Version" menu, version 7.2.6 option is ready for selection. 
  • After select "7.2.6" menu and wamp manager has been restarted, browse to the site, PHP version 7.2.6 is displayed.