Setting up PHP with IIS on a Windows OS has never been so easy. The PHP Manager for IIS makes it really to easily install, configure, manage and troubleshoot one or many PHP versions on the same IIS server. So if you are looking to setup PHP on your Windows 7 machine with IIS 7, follow the below steps.
I. Enable IIS on your machine:
- In Start Menu, choose Run or press Windows Key+R to launch the Run dialog and type “optionalfeatures.exe” and click OK.
- This launches the Windows Features where you can turn on/off default Windows programs and applications.
- Enable Internet Information Services (IIS)
- Expand the Internet Information Services node and open World Wide Web Services and then Application Development Features.
- Select CGI*, ISAPI Extensions and ISAPI Filters (Refer the image below)
*We are doing a FastCGI Implementation of PHP on IIS here, which works better than on Apache on Windows.
II. Download and Extract PHP
- Download the latest version of PHP for Windows from http://windows.php.net/download/
- Choose the ZIP file under VC9 x86 Non Thread Safe version
- Here is the direct link to 5.3.8 which is stable now – Download PHP 5.3.8
- Extract the ZIP file to C:\PHP\ or any folder of your choice.
III. Install PHP Manager
- Download the PHP Manager from this site: http://phpmanager.codeplex.com/releases/view/69115
- If you are running a 64 bit version of Windows, make sure you downlaod PHP Manager 1.2 for IIS 7 – x64
- Install PHP Manager
IV. Configure PHP in IIS
- Open IIS Manager (Control Panel\System and Security\Administrative Tools\Internet Information Services (IIS) Manager) – Type inetmgr.exe in the Run dialog.
- You can see the PHP Manager Icon in the main window.
- Open PHP Manager.
- Click on Register New PHP Version and provide the path to php-cgi.exe in the dialog opened. (Refer the image below)
- php-cgi.exe will be in the folder where you extracted the downloaded PHP software in the above step.
That’s all! Your PHP has been configured on IIS7. Click on Check phpinfo() to see whether it did it correct. PHP Manager has taken care of everything related to configuring PHP on IIS. PHP Manager does the following things.
- Register PHP with IIS;
- Validate and properly configure existing PHP installations;
- Run multiple PHP versions side by side on the same server and even within the same web site;
- Check PHP runtime configuration and environment (output of phpinfo() function);
- Configure various PHP settings;
- Enable or disable PHP extensions;
- Remotely manage PHP configuration in php.ini file.
You can now easily setup multiple PHP versions and configure them. You don’t need to edit the php.ini file in a text editor anymore. This tool makes it easy to enable/disable extensions and change the configuration settings.
If you see any errors related to Fast-CGI quitting unexpectedly or missing MSVCR110.dll, install the Microsoft Visual C++ Redistributable software and make sure you chose the 32 bit version if you installed the x86 version of PHP. You can download the package here: http://www.microsoft.com/en-us/download/details.aspx?id=30679