Wednesday, September 10, 2014

How to manually add a php version to WampServer?

Why do I need this?


WampServer is a great web development environment but it's a bit outdated so if you want to work with latest php you need to do it manually.

Prerequirements


You need to have WampServer 2.5 or later (may work for older versions too), if you don't know how to install WampServer check my tutorial here.

Where to download?


You can download the latest php version from the official site. Based on your machine you will download the 32-bit or 64-bit, if you don't know which is for you download the 32-bit. You also need to download the Thread Safe version, difference between Thread Safe and Non Thread Safe can be found here. If the latest version is 5.6.0 as your read this then you can download it directly from below links (official links).


How to install it?


Go to C:\wamp\bin\php directory, there you will see the old php version in my example is php5.5.12. Now create a folder phpx.x.x based on the version you downloaded without deleting the old one, in my example is php5.6.0 and extract all the files there. Clone (copy-paste) php.ini-development and then rename that cloned file to php.ini. Below are the required changes that you must do and some optional that you can skip or modify as you want.

Required


extension_dir = "c:/wamp/bin/php/php5.6.0/ext"

Recommended


error_log = "c:/wamp/logs/php5.6.0_error.log"
upload_tmp_dir = "c:/wamp/tmp"
mysql.default_port = 3306
session.save_path = "c:/wamp/tmp"
Uncomment
intl.error_level = E_WARNING
WampServer by default loading those extension but I suggest to comment back the ones you don't use
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_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_openssl.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_shmop.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll

If you want to install the Xdebug check my tutorial here.

Save and close the file. Clone it once more as phpForApache.ini. Now go to the php5.5.12 folder and copy the wampserver.conf inside the php5.6.0 folder. Exit from WampServer and open it again, now click to the WampServer tray icon, PHP, Version and now you will see that there are 2 php versions the 5.5.12 and the 5.6.0. Click on the one that you want to use, both works.

Notes:


After installing php5.6.0 I went to my C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf to do the following change:

LoadModule php5_module "c:/wamp/bin/php/php5.6.0/php5apache2_4.dll"

but after restarting all services the wamp icon became orange. If you have the same problem then either don't change that line or rename the php5apache2_4.dll that is inside the php5.6.0 to php5apache2_4(2).dll and then copy the php5apache2_4.dll from the php5.5.12 to the php5.6.0.

Verify that it works


Go to the localhost and you will see PHP Version : 5.6.0

1 comment: