Publish: 2015-01-07 | Modify: 2015-01-07
Recently, I have been using smarty templates to write some small programs. I wanted to test them on SAE, but encountered an error after uploading to SAE. The error message is: "SAE_Fatal_error: Uncaught exception 'SmartyException' with message 'unable to write file ./...' ". This is because SAE platform does not support file read and write operations.
To solve this issue, SAE provides a solution which is to use Memcache. Here are the steps:
Go to the application management in SAE and enable Memcache in the service management.
Modify the Smarty configuration file:
// For SAE, store compiled files in memcache
$smarty->compile_dir = 'saemc://smartytpl/';
$smarty->cache_dir = 'saemc://smartytpl/';
$smarty->compile_locking = false; // Prevent calling touch, saemc will automatically update the time, no need for touch
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.