


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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The differences between php5 and php8 are in terms of performance, language structure, type system, error handling, asynchronous programming, standard library functions and security. Detailed introduction: 1. Performance improvement. Compared with PHP5, PHP8 has a huge improvement in performance. PHP8 introduces a JIT compiler, which can compile and optimize some high-frequency execution codes, thereby improving the running speed; 2. Improved language structure, PHP8 introduces some new language structures and functions. PHP8 supports named parameters, allowing developers to pass parameter names instead of parameter order, etc.

To resolve the plugin not showing installed issue in PHP 7.0: Check the plugin configuration and enable the plugin. Restart PHP to apply configuration changes. Check the plugin file permissions to make sure they are correct. Install missing dependencies to ensure the plugin functions properly. If all other steps fail, rebuild PHP. Other possible causes include incompatible plugin versions, loading the wrong version, or PHP configuration issues.

How to install the mongo extension in php7.0: 1. Create the mongodb user group and user; 2. Download the mongodb source code package and place the source code package in the "/usr/local/src/" directory; 3. Enter "src/" directory; 4. Unzip the source code package; 5. Create the mongodb file directory; 6. Copy the files to the "mongodb/" directory; 7. Create the mongodb configuration file and modify the configuration.

How to change port 80 in php5: 1. Edit the port number in the Apache server configuration file; 2. Edit the PHP configuration file to ensure that PHP works on the new port; 3. Restart the Apache server, and the PHP application will start running on the new port. run on the port.

In php5, we can use the fsockopen() function to detect the TCP port. This function can be used to open a network connection and perform some network communication. But in php7, the fsockopen() function may encounter some problems, such as being unable to open the port, unable to connect to the server, etc. In order to solve this problem, we can use the socket_create() function and socket_connect() function to detect the TCP port.

Common solutions for PHP server environments include ensuring that the correct PHP version is installed and that relevant files have been copied to the module directory. Disable SELinux temporarily or permanently. Check and configure PHP.ini to ensure that necessary extensions have been added and set up correctly. Start or restart the PHP-FPM service. Check the DNS settings for resolution issues.

How to install and deploy php7.0: 1. Go to the PHP official website to download the installation version corresponding to the local system; 2. Extract the downloaded zip file to the specified directory; 3. Open the command line window and go to the "E:\php7" directory Just run the "php -v" command.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...
