Audience
Infrastructure Linux Admin
Overview
This guide provides step-by-step instructions for upgrading or installing PHP on a Windows Server 2012 R2 environment using IIS Manager or manual installation. It covers selecting the correct PHP version, configuring handler mappings in IIS, and ensuring compatibility with applications like Matomo. Additionally, it details necessary modifications to the php.ini file to optimize PHP functionality and performance.
Steps for Upgrading/Installing PHP
System requirements:
Windows Server 2012 R2 Hardware platform that can support Windows Server 2012 R2/Virtual Environment IIS 6 or above
Installing PHP using IIS Manager:
- Logon to the server with administrator rights.
- Open IIS Manager
- On the left side Locate the server and click it.
- On the right side you will see an Icon "Get New Web Platform Components"
- When the Program opens you will see a search box on the top right side. Type in the box "PHP" without the quotes. And press enter.
- Locate the version of PHP you desire to install. For our purposes we are upgrading to the most recent version 7.0.0. Select PHP 7.0.0 (x64). Click Add. This will install both x86 and x64 versions
- Once you have clicked Add you are ready to install. Click Install and the program will download all the required options. Some of these will not properly install, but those options we do NOT require (PHP manager for IIS). It will install (Windows Cache Extension 2.0 for PHP 7.0 (x64)).
- The installation process is complete and now we need to tell the website to use it.
- Using IIS Manager Highlight the website on the left side.
- Locate the "Handler Mappings" on the right and double click it.
- You should see multiple PHP entries. The newest one should be labeled "PHP_via_FastCGI". To verify this double click that entry and look at the Executable path. It should point to the new PHP folder you just installed. If the path is correct click "OK" if it is not correct modify it to point to where you installed PHP.
- The most important step is to modify the order in which the handlers are used. On the right side you will see an option for "View Ordered List". Click that to view the current order.
- We must move the NEW PHP entry higher than the previous PHP entries. This will force PIWIK to use the newer version.
- After you are done making changes we need to check that PIWIK is properly using the new PHP version.
- Using a browser of your choice Open the PIWIK site you have created.
- Login with administrator access to PIWIK.
- On the top right hand corner locate the spoke wheel to access the administrator functions.
- Onn the left bottom side you will see the option for a "System Check". Click that option.
- The very first line should identify your PHP version.
Installing PHP manually:
- The first step is to determine the correct PHP version for your system. This requires checking compatibility for Matomo and Windows Server.
- Next go to the PHP site to download the appropriate package.
- Download the PHP Non-Thread package because we are using IIS.
- Extract the package to a new directory on the server following this path: C:\PHP\v1.2.3 etc
PHP.ini changes:
open_basedir line - 318
extension directory - 770
CGI force redirect - 787
fast CGI impersonate - 819
Dynamic extensions:
extension=gd - 927
extension=mbstring - 933
extension=mysqli - 935
extension=pdo_mysql - 941
References:
Feedback and Concerns:
If you have any feedback regarding this article, please reach out to hsitkb@pitt.edu. You can also leave a comment below as well.