White screen fault caused by php-smarty

Source: Internet
Author: User
Tags smarty template
Today comes a big and tricky question-after updating the Smarty template, the page is white, but in the pre-release environment, there's no such thing as a test! Finally, the reason is found to be related to the Smarty template compiling principle.

Write a simple smarty page, run to view the template's compilation directory, and find the corresponding compilation file.

 
  Decodeproperties (Array ('  file_dependency '    = = Array (' 177DFB3E2809E44A1FF3A49D04E73219944E3FEF ' = >     Array (      0 = ' tpl\\test.htm ',      1 = 1458725943,         #注意到这个值1458725943为2016/3/23 17:39:03      2 = ' file ',    ),.........  ' Has_nocache_code ' = False,), false); /*/%%smartyheadercode%%*/?>
What happens if I adjust this value to a future time (2016/3/23 23:16:5) and modify the template file? You can see that even if we modify the template, the page is unchanged, that is, the Smarty template is not recompiled. So what does 1458725943 mean by this time? This time, is the modification time of the template file. In summary, if your updated template file is modified earlier than the pre-overwrite template, then Smarty will not recompile (the development environment will cause this problem if the system time is incorrect).

However, the problematic Smarty template was developed by the same developer, and it was also possible to verify that the new version of the template file was modified in the correct time, which led to white screen. Later, also finally found out the reason-because the file upload process, the modification time of the file is the current time of the server, resulting in Smarty compiled incomplete template files, resulting in the white screen. When the template file is uploaded, the modified time of the file becomes the actual modification time, and Smarty is no longer compiled.

Before uploading the Smarty template has not encountered this problem, but the high-volume server, the probability of the problem will also increase.

Solution:

After you update the template file, you need to empty the Smarty compilation directory.

The above describes the php-smarty caused by white screen failure, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.