White screen fault caused by PHP-smarty

Source: Internet
Author: User
: This article mainly introduces the white screen fault caused by PHP-smarty. if you are interested in the PHP Tutorial, please refer to it. Today, I encountered a big and tricky problem. after updating the smarty template, the page was displayed in white. However, this problem was not found during testing in the prerelease environment! Finally, I found the cause, which is related to the template compilation principle of smarty.

Compile a simple smarty page, view the template compilation directory, and find the corresponding compilation file.

 DecodeProperties (array ('File _ dependency '=> array ('177dfb3e2809e44a1ff3a49d04e73219944e3fef' => array (0 => 'tpl \ test.htm', 1 => 1458725943, # note that the value 1458725943 is 17:39:03 2 => 'File ',),......... 'Has _ nocache_code '=> false,), false);/*/% SmartyHeaderCode % */?>
If I adjust this value to the future time () and modify the template file, what will happen? We can see that even if we modify the template, the page does not change, that is, the smarty template has not been re-compiled. So what does the time 1458725943 mean? This time is the modification time of the template file. To sum up, if the modification time of the template file you Updated is earlier than that of the previous template, smarty will not re-compile (this problem will occur if the system time in the development environment is incorrect ).

However, the faulty smarty template is developed by the same developer, and the modification time of the new template file can also be confirmed, which leads to a white screen. Later, I finally found out the cause-because the modification time of the file to be repaired is the current time of the server during the file upload process, smarty compiled an incomplete template file, resulting in a white screen. After the template file is uploaded, the modification time of the file changes to the actual modification time, and the smarty will not compile again.

This problem has not been encountered before uploading the smarty template, but on servers with high concurrency, the probability of problems will also increase.

Solution:

After updating the template file, you need to clear the compilation directory of smarty.

The above introduces the white screen fault caused by PHP-smarty, including some content, and hope to be helpful to friends who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.