Smarty For SAE (smarty is used in sae)

Source: Internet
Author: User

Smarty is a very popular template system. It separates business and logic, and runs fast. It is widely used in php websites.
However, a problem occurs when deploying it to sina app engine (sae). Because sae cannot perform file read/write operations as a cloud computing platform, the cached files output in Smarty cannot be implemented.
Error message: "SAE_Fatal_error: Uncaught exception 'smartyexception' with message 'unable to write file./web/templates_c/wrt4e95555280ef1 '"
The solution provided by SAE is to use Memcache. First, go to Application Management in the application, and enable Memcache initialization in service management,
Then modify the configuration file of Smarty:

// For SAE compiled files are stored in memcache
$ Smarty-> compile_dir = 'saemc: // smartytpl /';
$ Smarty-> cache_dir = 'saemc: // smartytpl /';
$ Smarty-> compile_locking = false; // to prevent touch calls, saemc automatically updates the time without touch
The preceding three rows are required.
In this way, the Smarty template can be run on SAE.

 

 

From neural Style Neural Networks

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.