Home → Installation and Upgrade Manual → Upgrading Dependancies → Upgrading PHP on Windows
3.1. Upgrading PHP on Windows
In order to upgrade your PHP version, you will want to download the latest compatible version of PHP from the Windows PHP distribution site: http://windows.php.net/download/.
Check the system requirements page for the most up to date information on the latest version of PHP supported by HelpSpot: https://helpspot.com/requirements. At the time of this KB edit, the latest version is 8.1 NTS x64 (for IIS) or 8.1 TS x64 (for Apache).
After extracting the download, make a backup of your current PHP folder found in your HelpSpot installation. If you initially installed using the Legacy Installer (.exe) your HelpSpot installation can be found under C:\Program Files (x86)\helpspot and the PHP folder will be at C:\Program Files (x86)\helpspot\php. If you used the modern, step-by-step Windows instructions, your HelpSpot installation will likely be at C:\inetpub\wwwroot, and the PHP folder will be at C:\PHP.
Stop your webserver before beginning any of the steps outlined below.
Major-version Updates vs Minor-version Updates
Performing major-version upgrades (such as PHP 8.0 to 8.1) requires a slightly different approach than minor-version updates (such as PHP 8.0.1 to 8.0.5).
Minor-Version Upgrades
For minor-version upgrades, we don't want to overwrite the entire PHP directory with the updated version, as there are HelpSpot specific files and settings that would be lost. Instead, the easiest approach is to copy all of the files (not folders) from the root directory of the extracted PHP download into the root directory of your existing PHP folder. Then do the same within each of the PHP subfolders. This will preserve the HelpSpot customizations but get you running on the latest binaries.
Major Version Upgrades
For major-version upgrades, you can rename the existing PHP root directory and create a new, empty "PHP" root directory in the same parent folder, then move the newly extracted PHP files into the new PHP directory. You can then copy the below files and folders from the old, renamed PHP directory into the new PHP root:
- /PHP/cacert.pem
- /PHP/tmp/ (entire directory)
Because major-version upgrades require new SQL drivers, you will also need to download the correct SQL Server drivers for your new PHP version from Microsoft's GitHub repository: https://github.com/microsoft/msphpsql/releases/latest
After you have completed this process, start your webserver again, and you should be running the latest version of PHP. You can confirm this by opening a command prompt in your PHP root directory and entering the command: php -v
Moving PHP From Legacy Configuration to Modern Configuration
If you are moving your PHP installation from the old Program Files (x86)-based install location to the current C:\PHP root directory, there are a few more changes you'll need to make for the system to recognize the new configuration.
IIS will have a Handler Mapping telling the server where the PHP executable is found. You will need to edit the exisitng PHP Fast CGI handler mapping to point to the php-cgi.exe in the new PHP folder path. This is performed within the IIS management console by selecting the server in the left nav tree and double-clicking the Handler Mappings icon in the main pane.
The php.ini file contains some HelpSpot-specific directives pointing to the legacy paths which will need to be updated to their new paths, as shown below.
- curl.cainfo="C:\Program Files (x86)\helpspot\php\cacert.pem" becomes curl.cainfo="C:\PHP\cacert.pem"
- openssl.cafile="C:\Program Files (x86)\helpspot\php\cacert.pem" becomes openssl.cafile="C:\PHP\cacert.pem"
- upload_tmp_dir="C:\Program Files (x86)\helpspot\php\tmp" becomes upload_tmp_dir="C:\PHP\tmp"
The system's Environment Variables will need to be updated to reflect the new PHP location. Right-click on the computer in a File Explorer window and select Properties from the context menu. Click Advanced System Settings in the left nav of the management window and then click the Environment Variables button at the bottom of the Advanced Properties window.
Within the Environment Variable editor window, you should reference the lower pane for System Variables. Within this pane, you will need to first select the PATH variable and edit the PHP entry to reflect the new PHP folder path. You can then locate the PHPRC variable and edit it to point to the new PHP folder path. Note that you will need to close and reopen any CMD windows in order for them to detect the new Environment Variable paths.