Monday, 7 December 2015

PHP7 installation in Windows with Apache 2.4

Now PHP7 is released on 03 December 2015 and it is 50 percent faster then PHP5.6 with lot more feature. So, why we not go for this so, I have decided  to install it. Oh Great.

First I thought it may be available in xampp or wamp software  but too sad it is not. Hmm my work is increase. Now I need to install Apache too. So, I downloaded the apache from link https://www.apachelounge.com/download/httpd-2.4.17-win64-VC14.zip 

Also, I need to install VC 14 from https://www.microsoft.com/en-us/download/details.aspx?id=49984, if the sytem not has visual studio 2015 installed.

As I have downloaded the Apache 2.4. so,  extracted it in my system directory D:\httpd-2.4.12-win64-VC11\Apache24.

Okay Now open the file D:\httpd-2.4.12-win64-VC11\Apache24\conf\httpd.conf and make the below changes.
Go to line No - 37
Change the ServerRoot "c:/Apache24"
to
ServerRoot "D:/httpd-2.4.12-win64-VC11/Apache24"

Got to line No - 243
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
to
 DocumentRoot "D:/httpd-2.4.12-win64-VC11/Apache24/htdocs"
<Directory "D:/httpd-2.4.12-win64-VC11/Apache24/htdocs">

And added some code at the end of the file below:-
LoadFile "D:/php-7.0.0-Win32-VC14-x64/php7ts.dll"
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .html .html
LoadModule php7_module "D:/php-7.0.0-Win32-VC14-x64/php7apache2_4.dll"

<IfModule php7_module>
        PHPIniDir "D:/php-7.0.0-Win32-VC14-x64"
</IfModule>
After make the above changes, opened command prompt  and run as a administrator
Go to the Apache bin directory
C:\Windows\System32>D:
D:>cd D:\httpd-2.4.12-win64-VC11\Apache24\bin
D:\httpd-2.4.12-win64-VC11\Apache24\bin>httpd -k install -n "Apache24"

Then started the apache
D:\httpd-2.4.12-win64-VC11\Apache24\bin>httpd -k start

Well no Error, working fine.

Now, time is come to download and install php7.

Going to link http://windows.php.net/download/ and downloaded VC14 x64 Thread Safe.

Extract the zip folder to path -  D:\php-7.0.0-Win32-VC14-x64 and rename the file php.ini-development to php.ini. That's it.

Finally we need to test the php is working or not. so, created one php file(phpinfo.php) in the directory D:\httpd-2.4.12-win64-VC11\Apache24\htdocs. Inside the file written the code below and saved.

<?php
 phpinfo();


Now Open the browser type the url http://localhost/phpinfo.php and GO.

It is now showing the php information. It is working Great :-)

Thanks for reading my blog.