Overall Introduction:
The Aliyun Cloud Engine (ACE) provides a running environment based on PHP 5.3.5 (Runtime Environment) that supports standard relational databases, Memcache, Cron, session, storage, At the same time, add some advanced features to meet the needs of developers. Ace chose PHP as the preferred support language, mainly because the current domestic developers to use the PHP language is the largest proportion of the future will consider supporting the holding of Node.js,asp.net,python and Java.
The PHP runtime of Aces and the official standard PHP environment are almost exactly the same, and 99% of the code can be perfectly run in the ACE environment without any modification. Ace has made some extensions and improvements to standard PHP for security and performance reasons. Ace PHP will be upgraded with an official version upgrade, and when the official version is upgraded, we will evaluate how important it is and incorporate it into our runtime based on the ACE's own characteristics.
Limit:
ACE platform to ensure the application of security and stability, the various types of services set a number of restrictions and quotas, users should read carefully before use, to avoid problems in use:
1. Resource constraints
Memory_limit: Scripts can allocate memory by default: 32M
Post_max_size:post data size default: 10M
Upload_max_filesize upload File size default: 4M
2. Disabling functions
For security reasons, the ACE disables some PHP functions, and the disabled standard has four main points:
1) for security reasons
2) In view of resource management
3. API not commonly used
4 We provide a better alternative to the API
For a detailed list of restrictions please refer to: List of safe disabling functions
3. How to Solve
The specific impact of the security disabling function and the workaround:
1) file Caching
Ce local file read and write restrictions, although through the above file read and write synchronization can be achieved, but in view of the efficiency problem, we recommend that the file cache to deploy a layer of full-text memcache cache structure.
2) Memcache Cache
Connection
$mem = new Memcache (); Create the Memcache object, and internal access to the agent gets the address and ID
$mem->init ();
Save data
$mem->set (' key1 ', ' This is ', ' 0, 60 ');
$val = $mem->get (' Key1 ');
Replace data
$mem->replace (' key1 ', ' This is replace value ', 0, 60);
$val = $mem->get (' Key1 ');
Save Array
$arr = Array (' AAA ', ' BBB ', ' CCC ', ' ddd ');
$mem->set (' Key2 ', $arr, 0, 60);
$val 2 = $mem->get (' Key2 ');
Delete data
$mem->delete (' Key1 ');
$val = $mem->get (' Key1 ');
Close connection
$mem->close ();
?>
3) Storage Services
The Move_uploaded_file method has not been used properly because the local file cannot be written directly, and the ACE provides method support instead
Move_uploaded_file ($tmp _name, $filename)
To be replaced by:
$ce = new Cestorage ();
$result = $ce->upload ($tmp _name, $filename);
# $rs 1 = $ce->errmsg (); Output error message
# $rs 2 = $ce->errno ();
$result the path to the returned attachment file, shaped like: www.domain.com/ACE_bucket/$filename
The path can be accessed directly.