I wanted to test out the new php7.0 alpha release in my local environment. I currently am running Windows 8.1 with Wamp Server installed. Wamp Server obviously doesn’t have a version to download yet with php7 so I figured I would try to get it to work myself. Here are the steps I took to get it to work:
1) Download the zip file from http://windows.php.net/qa/ under PHP 7.0 (7.0.0alpha1) labeled VC14 x64 Thread Safe
2) Extract the files to c:/wamp/bin/php/php7.0.0alpha1/ *My wamp directory is c:/wamp so you will see that throughout the instructions, if wamp is installed in another place make sure you use that directory for the remaining instructions.
3) You will need the new Visual C++ Redistributable for Visual Studio 2015 RC so download it from here and install: https://www.microsoft.com/en-us/download/details.aspx?id=48145
4) Download the php7apache2_4.dll from http://windows.php.net/downloads/snaps/ostc/69801/vc14/x64/ and put it in your c:/wamp/bin/php/php7.0.0alpha1/ directory
5) Next we need to setup your php.ini file. I have seen some people just copy over their php.ini file from php5 to php7 and said they didn’t have any issues. So you can do that if you want. Just copy php.ini and phpForApache.ini from c:/wamp/bin/php/php5.x (whatever version you were on) to c:/wamp/bin/php/php7.0.0alpha1/. You will then need to search for any references to “c:/wamp/bin/php/php5.x” and update them to point to “c:/wamp/bin/php/php7.0.0alpha1/”. If you go this route you can skip to step 8. I choose to use a fresh php.ini file for php7 to do this in the c:/wamp/bin/php/php7.0.0alpha1/ directory you should see php.ini-development and php.ini-production files, rename whichever you want to use (I used development) to php.ini
6) You will need to make some updates to the php.ini file so open it in a text editor. You will need to change “extension_dir”, “error_log”, “upload_tmp_dir” and a few other variables. Also you will need to enable the modules you want, you can look in c:/wamp/bin/php/php7.0.0alpha1/ext/ to see which ones are available . I enabled the following:
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_mbstring.dll extension=php_exif.dll ; Must be after mbstring as it depends on it extension=php_mysqli.dll extension=php_openssl.dll extension=php_pdo_mysql.dll extension=php_pdo_pgsql.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
7) Once you have your php.ini file updated make a copy of it and save it as phpForApache.ini
8) Copy wampserver.conf from c:/wamp/bin/php/php5.x (whatever version you were on) and paste it in c:/wamp/bin/php/php7.0.0alpha1/. Open the file and update it so that it says:
$phpConf[‘apache’][‘2.4’][‘LoadModuleName’] = ‘php7_module’; $phpConf[‘apache’][‘2.4’][‘LoadModuleFile’] = ‘php7apache2_4.dll’; $phpConf[‘apache’][‘2.4’][‘AddModule’] = ”;
9) Close Wamp server completely, right click on the green icon in your status bar and click Exit
10) Start Wamp server back up.
11) Left click the green icon once it is back up and running, and under PHP -> Versions you should now see 7.0.0alpha1 select it. Wamp server should restart and you should be able to go to http://localhost/?phpinfo=1 to confirm you are now running php7.
12) Have fun figuring out if your application still works 🙂
Note: If your code is still dependent on mysql_* functions don’t even think about trying this as mysql_* functions have finally been removed completely since they were deprecated.
If you have any issues leave a comment and I’ll see if I can help.