Thursday, November 20, 2014

Notes and screenshots related to installing PHP 5.6 on Windows 8.1

The Windows 8.1 Professional on my Toshiba Laptop Satellite Series S70 did not have any PHP to start with. I wanted to take a look at the SQL Server Driver for PHP in CTP. I decided to install PHP. Then make sure it works with IIS 8.0. IIS may not be activated by default. You can activate it from Control Panel (Turn Windows features on or off ).
More details regarding the SQL Driver here,
SQL Server driver (SQLServer31.exe, 499KB, version 3.1.CTP) for PHP is now available as a CTP.

PHP scripts can access Microsoft SQL Server and Microsoft Azure SQL Database.
You can download the CTP here:

Details of this version:
•This version supports PHP Version 5.5 and requires Microsoft ODBC driver 11 (or higher)
•It supports SQL Server 2012; localDB abd AlwaysOn features
•Buffered Queries are included

All SQL Server users can get it at no extra cost including SQL Server Express.

If the IIS 8.0 is activated you should be able to see the following screen when you access  http://localhost in  browser on your computer.

For the current laptop the following is the response:

Assuming you had no problem activating IIS 8.0 we can move to the next step of installing PHP 5.x.

Downloading and installing PHP 5.X:

PHP can be downloaded (free) using the latest Web Platform Installer (WebPI) which happens to be WebPI version 5.0 from here:

The advantage of using the WebPI is that not only it installs the PHP engine but also configures it to work with IIS.

Launch WebPI (wpilauncher.exe 113 KB) which brings up the following page where you searched for PHP (there are many others):

There is no Version 5.5 which is supposed to pair with the SQL Server Driver for PHP in CTP mentioned earlier. Install version 5.6 by highlighting it, it first checks for prerequisites and then installs.

Accept and the install starts as shown.
When the installation is completed, you will be seeing the following in your Control Panel under Programs as shown.
Also under Program Files (x86) you would all the PHP files in two folders PHP: v5.3 and v5.6.
If you now access IIS 8 by typing in 'IIS' in the Search charm it will display the Internet Information Services (IIS) Manager link. If you click on this link you should be able to see the following when you look for Handler Mappings:
In the IIS 8's Home you would see both PHP Manager and FastCGI Settings as shown.
In order to complete the installation check if the CGI is enabled in the Control Panel as shown.

In order to test if the installation was successful you need to run a small PHP script in your localhost. In order to do this type out the following code in Notepad and save it with the extension php in the root folder of your computer.

The file is very simple as shown in the next paragraph.
If your PHP engine is working well you should see the following (only part of a very long page is shown) when you browse this file in your IIS or type the following in the address box of your browser.
This completes the installation of PHP 5.6 on Windows 8.1 Professional that works well with IIS 8.0
In a future post we take a look at accessing SQL Server 2012 from a PHP application.




Daniel said...

please show me screenshots for accessing my (localdb)\MSSQLLocalDB with PHP 5.6 - I have followed these instructions so far, but I can't access my server/database.

Nanditha said...

Every I did as mentioned above,but while executing the php pgm I am getting http 404.0 error with error code 0x80070002...please help me Protection Status