Steps to Install PHP manually on Windows 2016 server
In this blog, we will show the steps to install PHP manually on Windows 2016 server.
REQUIREMENTS
- Virtual Machine
- IIS Web Server
- WinCache Extension for PHP
- PHP Binary Files
- VC++ Compiler
INSTALLING IIS
- Open the Windows PowerShell and type the below command to install IIS service with CGI extension.
Install-WindowsFeature -name web-server,web-cgi –IncludeManagementTools
- It will take few minutes to complete the installation.
- Once the installation is completed, verify the CGI feature was installed in the server using the below command.
Get-WindowsFeature web-cgi
INSTALLING PHP
- Go to the below URL to download the PHP 7.1 version.
http://windows.php.net/download/
- Extract the ZIP file to C:\program files folder.
- There will be two PHP.ini files are available in that folder. Rename the php-.ini-development to php.ini.
- Open the php.ini file Add the following line at the end of the file.
extension=php_wincache.dll
- Save and close the php.ini file.
- Right-click on the windows start menu and click on system.
- Click on Advanced system settings.
- Click on Environment Variables.
- Under System Variables, select path variable and click on Edit.
- Click on New button and add the PHP binary path.
- Click OK thrice to close the system properties window.
INSTALL WINCACHE EXTENSION
- Browse the below URL to download the Wincache extension for PHP.
https://www.iis.net/downloads/microsoft/wincache-extension
- Scroll down and download WinCache 2.0 for PHP 7.1 under download section.
Note : In this demo, we are installing PHP 7.1, so we are downloading corresponding wincache version
- Once you download, double-click on the wincache-2.0.0.8-dev-7.1-nts-vc14-x64.exe file and extract the files to a folder.
- Copy the php.wincache.dll file to C:\Program Files\php-7.1\ext folder.
CONFIGURE PHP IN IIS
- Open IIS snap-in and click on the server name.
- Double click on Handler Mappings icon.
- Click on Add Module Mapping… under actions menu.
- Provide the below information as shown below. And click on Request Restrictions, under Mapping make sure you have select the File or Folder button.
- Click OK twice to close configuration window. Now the PHP will be listed under Handler Mappings List.
INSTALLING VC++
- Browse the below URL and download the Microsoft Visual C++ 2015 Redistributable Update 3 RC package.
https://www.microsoft.com/en-us/download/details.aspx?id=52685
- Click on Download and select vc_redist.x86.exe and click Next.
- Once the download is complete, double-click on the vc_redist.x86.exe file. Accept the License Agreement and click on Install button.
- Once the installation is successful click on close button.
VERIFYING PHP
- To Verify the PHP extension, place a file named phpinfo.php in your root folder of IIS website and add the below lines in that file.
<?php
phpinfo();
?>
- Open the web browser and access the URL http://localhost/phpinfo.php and able to see the PHP configuration information.
VIDEO
Thanks for reading this blog. We hope it was useful for you to learn to install PHP manually in windows 2016 server.
Loges