Verification: a143cc29221c9be0

Not installed php on your computer

Not installed php on your computer

Start with the WebPI App

Microsoft WebPI is the easiest way to install common web technologies onto a Windows PC. Start by going to the Microsoft Web Platform Installer home page. At the bottom of the WebPI install page, under Download WebPI are options for 64-bit Windows (x64), and 32-bit Windows (x86). Choose the download version correct for your Windows.

(To check which version of Windows you have run the System Information app. Type system in the search box and run System Information. Look at the System Type entry to see if it is a x64 or x32 system.)

Run the installation for the Web Platform Installer. If not logged in as a Computer Admin then the administrator password will be required. Once installed type Web Platform in the Windows search box and select Microsoft Web Platform Installer. To run WebPI an administrator account is required. For a standard user use the context menu (normally right-click) and select Run as administrator, entering the correct admin password.

Selecting WebPI

Install PHP on Windows with WebPI

PHP installs are listed in Frameworks in WebPI.

PHP installs in WebPI

Alternatively use search in WebPI to find the PHP packages:

Install PHP in WebPI

For testing PHP on the local Windows machine a webserver is required. Internet Information Services (IIS) is the default Windows webserver. You can set up IIS manually, but if IIS is not already installed, use WebPI to install IIS at the same time as installing PHP.

Install IIS with WebPI

The installer will add other required packages as necessary. Click the Install button and accept the licenses.

Accept WebPI Conditions

WebPI will show a list of all the packages installed.

Installed WebPI Packages

On newer versions of Windows there may be an error message saying that PHP Manager for IIS failed to install. This is a known issue and is only a problem if testing multiple versions of PHP. PHP Manager offers an easy way to switch between different PHP versions. There is a workaround available, however, if using a single version of PHP then PHP Manager is not required.

The installed PHP is now ready to use. Confirm it is working by creating a PHP test page. To see how to set up a website in IIS read everything after section How to Host a Website in IIS in Windows in the article Web Server on Windows with IIS. Use Windows Notepad to create a PHP test file, e.g. called php-test.php. Add the following to the file and save it into the website.

Then browse to it, if everything is installed correctly then PHP info will be shown (otherwise check the IIS configuration, covered in next section):

Testing PHP on IIS

Configure IIS Express for PHP Web Pages

If the PHP test file is not working then check the PHP configuration in IIS. For example 32-bit IIS Express will be installed in:

C:\Program Files (x86)\IIS Express

And an appropriate PHP will be installed in a sub-directory by WebMatrix:

C:\Program Files (x86)\IIS Express\PHP\v5.6

Likewise, for 64-bit IIS Express the install location is usually:

C:\Program Files\IIS Express

And an appropriate PHP:

C:\Program Files\IIS Express\PHP\v7.3

The configuration files for IIS Express are in the IISExpress\config directory in the logged on users Documents folder. The configuration file applicationhost.config can be checked for the correct setup for PHP. The file applicationhost.config can be edited in any text editor, such as Windows Notepad or Notepad++. A default PHP script for a website can be added to the section, for example, here is index.php added to the end of the section.

Next, if the section is empty add the correct settings for the installed PHP. This example is for 64-bit PHP version 7.3:

The next step is the configuration:


Finally, a section for a website, before the closing tag, references the correct PHP handler. For example for the website named EmptySite (which would mimic the website's name in the section):


A correctly configured applicationhost.config file should allow the PHP test file to display correctly.