First of all, does ThinkPHP3.2.3 support php7? Absolutely.
Under windows, the previous project was deployed in Apache2.4.17 php5.x version. Because the customer's network security scan found many vulnerabilities, including high-risk vulnerabilities in apache and php, as many as hundreds of times. , in urgent need of repair, if not repaired, there will be a risk of site closure.
So I contacted the software supplier, who previously promised to cooperate with the upgrade, but ultimately failed to upgrade. The reply given was that ThinkPHP3.2.3 cannot be deployed in php7.
So I had to rely on myself. After groping for three or four days, I finally upgraded successfully. Now I will share with you the general process.
Recommended (free): PHP7
1. Upgrade apache, download address http://httpd.apache.org/download.cgi , the downloaded version is, 2.4.33
The most important one is the configuration file as shown below:
##apache loading php support
PHPIniDir d:/GPS-LOCK/php/php.ini
LoadModule php7_module D:/GPS-LOCK/php/php7apache2_4.dll
Encountered many problems in this step, enable the PHPIniDir path, Apache could not start. Finally, it was found that the php.ini file referenced php_ptheads.dll multi-threading. After repeated attempts, the problem was solved.
2. Upgrade php, download address: https://windows.php.net/download/ What is downloaded here is 7.2.26,
Now we will summarize the problems expected when upgrading php7
1. Here you need to install the compiled vc class library version corresponding to php7, vc_redist.x64.exe, the installation is vc15
2, sql server database support
This is because php7 does not load the sql server related dll by default
3. You need to download Microsoft Drivers for PHP for SQL Server https://www.microsoft .com/en-us/download/details.aspx?id=20098, I downloaded version 7.2
Modify the location file as follows
4, In the php.ini file of php7, ext omits php_.dll. Just configure it as shown above. Currently, you need to copy the decompressed file to the php\ext directory.
3. I think the system can run normally under php7. As a result, the project uses multi-threading and requires PHP to support pthreads. It is about to crash. After adding extension=pthreads to the php.ini file, apache cannot start again. It turns out that ptheads needs to be run in cli mode. The ptheads download address is https://windows.php.net/downloads/pecl/releases/pthreads/
Unzip the download package
1. Put pthreadVC2. The dll file is placed in the php root directory
2. Copy php_pthreads.dll to the php\ext directory.
Start apache again and find that it cannot be started. After searching a lot of information, it turns out that ptheads needs Running in cli mode, my solution is to create two php.ini configuration files, one for the site to use php.ini and the other php-cli.ini file for ptheads to use. The contents of the files are the same. At this point, the upgrade is finally completed. .
Since the original poster was not born in a PHP major, he took many detours, but the loophole was finally fixed. If everyone also encounters this problem, you can communicate and discuss it together.
The above is the detailed content of Introduction to the process of upgrading ThinkPHP3.2.3 from php5 to php7. For more information, please follow other related articles on the PHP Chinese website!