[Tutorial] How to add another PHP version (PHP 7.3)
Do I need NTS or TS. I'm just doing development on my home computer. I notice that the versions that come with appear to be TS, since NTS is not mentioned in the version information. Is this correct? Does it even matter?
@Michael-Chean : There are a few different between NTS & TS. Laragon handle the differences for you. Most people use TS with Apache as well as Nginx. If you use Nginx, NTS is more suitable.
I got this error when changing the PHP version:
PHP Startup: Unable to load dynamic library 'curl' (tried: C:/laragon/bin/php/php-7.3.5-Win32-VC15-x64/ext\curl (The specified module could not be found.), C:/laragon/bin/php/php-7.3.5-Win32-VC15-x64/ext\php_curl.dll (The specified procedure could not be found.)) in Unknown on line 0
the solution: first turn off the server then change PHP version then start it up.
I wanted to run PHP 5.6, and had to figure out a couple things I thought I'd share.
First, the 5.6 or older releases aren't located on https://windows.php.net/downloads/releases/. You need to go to the "archives" subfolder to find them (ie https://windows.php.net/downloads/releases/archive).
Next, I scanned through to find the latest micro-release of 5.6- which I saw was 5.6.40. There were 5 versions of it:
I assume I didn't want the "source" version ("src") because that's probably going to be bigger and I'm not interesting in seeing how it was written, I just want to use it.
Next, based on @leokhoa's original description, because I have a 64-bit machine (does anyone use 32-bit machines nowadays?) I wanted one of the zips ending in "-x64.zip".
So that left two options: the one with "-nts-" in it, or not. I'm using Nginx for my webserver instead of a multi-threaded Apache, so I could use the more efficient NTS version.
So I downloaded " php-5.6.40-nts-Win32-VC11-x64.zip", put it in laragon's bin/php folder, extracted it there, and then chose that version from Laragon's menu. Except when I tried to load a page with Laragon, it hang for a few minutes, and then gave me some error message... something more was needed...
If something's wrong, please check and install correspond VC Redist (VC11, VC14, VC15...)
That took me a little while to figure out. The version of PHP I was trying to run had "VC11" in it, which stands for "Visual C++ 11". It seems "Visual C++" distributables are the files required to run programs made with "Visual Studio". Confusingly, "Visual Studio 2012" uses "Visual C++ 11" (it's like they released each new version of Visual C++ a year or so before the accompanying version of Visual Studio).
I found the link to download VC11 (aka "Visual Studio 2012 VC++ Redistributable") here, under "Redistributables and Build Tools".
After I downloaded that, and ran its installer, I could use PHP 5.6 with Laragon.
@mnelson4 : Many thanks for sharing this. It's very helpful.
Use this link to download php 7.3
I've tried to test PHP 7.4 Alpha 3 (php-7.4.0alpha3-Win32-vs16-x64). Since it was compiled with VS16, I have changed my Apache server to 2.4.39-win64-VS16
Unfortunately, I'm getting error: "Service Apache can not start. Reason: Unknown. Please check Apache log file".
But there is nothing in the log that would indicate any issue.
EDIT: I was sure that I had all the required VC16 files, but obviously not! After I reinstalled the Visual C++ Redistributable Packages for Visual Studio 2015-2019 x64:
it is working now!
I've do as you recommend, download last version of PHP (7.2.9), extract and it to PHP folder... as you can see :
After change PHP version, is still in v7.2.11... see:
$ php -v PHP 7.2.11 (cli) (built: Oct 10 2018 02:04:07) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
@wemersonrv : Did you switch to the version in Menu > PHP > Version?
Then close Terminal and try again.
Oh man! I just changed my PHP version to 7.3.3 and upon restart, all my local WordPress sites refuse to open with the same error:
Certificate key usage inadequate for attempted operation. Error code: SEC_ERROR_INADEQUATE_KEY_USAGE
Any help would be appreciated!