Home > Article > Backend Development > eaccelerator+PHP54 causes smarty update template 500 error
Problem background
After updating the smarty template of game.37.com business, multiple 500 error records appeared on the server. PHPThe error reported in the error log is as follows:
[16-May-2016 15:46:01 Asia/Shanghai] PHP Fatal error: Call to undefined function content_57397470478e99_59376883() in /*/template_c/6aede77242b 285842c628673e93d8bf1bd4bc6b0.file .server_list.htm.php on line 67
Phenomena: After updating the template, a 500 error is reported when accessing for the first time, but normal access occurs again.
Troubleshooting
According to the experience of normal use of smarty, after updating the template, it will not cause PHP to report 500 error. Therefore, it is guessed that it may be an environmental problem of the server, and a special configuration environment is listed for troubleshooting.
In the pre-release environment, check the accelerator eAccelerator as a priority. Because the eAcceleratoraccelerator caches the opcode of PHP, it may cause this problem.
Test in test environmentDebug page: http://game.37.com/server_list_275.html
Debug template: main.htm
generated smartycompiled file: /*/template_c/6aede77242b285842c628 673e93d8bf1bd4bc6b0.file .server_list.htm.php
Check the compiled files of smarty
Compare the 2edited files after the updated smartytemplate, and find that PHP The reason for the error is calling the old Functions in templates.
PHPException error messagePHP Fatal error: Call to undefined function content_573a944d7a2608_39051073() in /*/template_c/6aede77242b285842c628673e93d8bf1bd4bc6b0.file. server_list.htm.php on line 67
smartyWorking principle diagram:
The problem lies in updating the smarty template. Although smarty generates a new compiled file, the content of the old file is still cached by the accelerator, which contains the name of a function called in the template file. Open the hit log of the accelerator and you can view the relevant records:
Solution
1) Configure the accelerator filter parameters, smarty’s compiled files are not cached
eaccelerator.filter="! /*/template_c/*.php"
But the impact on performance needs to be evaluated
2) Change to acceleratorAPC
Reason: The eaccelerator currently used is the 1.0-dev version, which is not an officially released version. APC is from the official source and can be downloaded to the stable version.
The above has introduced the 500 error reported by smarty update template caused by eaccelerator+PHP54, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.