Home > Backend Development > PHP7 > body text

Let's talk about the difficult road of upgrading ThinkPHP3.2.3 from php5 to php7

coldplay.xixi
Release: 2023-02-17 20:12:02
forward
3002 people have browsed it

Let's talk about the difficult road of upgrading ThinkPHP3.2.3 from php5 to php7

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 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 and fumbled for three or four days. Finally, the upgrade was successful. Now I would like to 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 thing is the configuration file as shown below:

apache Load php support

PHPIniDir d:/GPS-LOCK/php/php.ini
LoadModule php7_module D:/GPS-LOCK/php/php7apache2_4.dll

Encountered in this step After many problems, apache could not start when the PHPIniDir path was enabled. 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. php.ini file in php7 , ext is omitted php_.dll Just configure it as shown above. Currently, you need to copy the decompressed file to the php\ext directory

3. Think the system is ready It runs 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 author 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 Let's talk about the difficult road of upgrading ThinkPHP3.2.3 from php5 to php7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!