Home >Backend Development >PHP Problem >What to do if modifying the php code does not take effect
The solution to the problem that the PHP code does not take effect: first check the program cache; then check whether the server has CDN acceleration enabled; then determine whether the Opcode cache is enabled in PHP; and finally configure the cache expiration time.
Recommendation: "PHP Video Tutorial"
Solution to the PHP modification that cannot take effect immediately and the update delay is not updated in time
Modify the PHP code and cannot update it in time. You have to wait for a long time to update it. It will take effect after restarting the php-fpm service!
Modify the PHP code, refresh the page and wait for the PHP feedback result. 1 second has passed, 2 seconds have passed, and there has been no response? Nani, what's going on? Wait until the Nth minute before the page is updated successfully.
Solution
First, check the program cache to make sure it is not a problem with the program framework opening cache settings.
Second, check whether CDN acceleration is enabled on the server. CDN acceleration caching may cause some updates to be delayed.
Third, finally determine whether PHP has enabled Opcode caching.
Use the phpinfo() function to check whether the PHP startup module contains opcode caches such as ZendOpcache.
If there is, then open php.ini and search for "opcache", change
opcache.revalidate_freq=60
to
opcache.revalidate_freq=0
opcache.revalidate_freq is the cache expiration time configuration, set after 60 seconds It means that the script will not update the changes after 60 seconds. If it is changed to 0, each modification will take effect in time, or it can be changed to another time.
If the above modifications do not take effect, check whether the modified location of php.ini is correct
The above is the detailed content of What to do if modifying the php code does not take effect. For more information, please follow other related articles on the PHP Chinese website!