Installation guide

We have taken great care to ensure that the SDK will perform well in an environment that utilizes an opcode cache.
Note
PHP 5.5 comes with an opcode cache that is installed and enabled by default:
http://php.net/manual/en/book.opcache.php
If you are using PHP 5.5, then you may skip the remainder of this section.
APC
If you are not able to run PHP 5.5, then we recommend using APC as an opcode cache.
Installing on Amazon Linux
When using Amazon Linux, you can install APC using one of the following commands depending on if you are using
PHP 5.3 or PHP 5.4.
# For PHP 5.4
yum install php54-pecl-apc
# For PHP 5.3
yum install php-pecl-apc
Modifying APC settings
APC configuration settings can be set and configured in the apc.ini file of most systems. You can find more
information about configuring APC in the PHP.net APC documentation.
The APC configuration file is located at /etc/php.d/apc.ini on Amazon Linux.
# You can only modify the file as sudo
sudo vim /etc/php.d/apc.ini
apc.shm_size=128M
It is recommended that you set the apc.shm_size setting to be 128M or higher. You should investigate what the right
value will be for your application. The ideal value will depend on how many files your application includes, what other
frameworks are used by your application, and if you are caching data in the APC user cache.
You can run the following command on Amazon Linux to set apc.shm_size to 128M:
sed -i "s/apc.shm_size=.*/apc.shm_size=128M/g" /etc/php.d/apc.ini
apc.stat=0
The SDK adheres to PSR-0 and relies heavily on class autoloading. When apc.stat=1, APC will perform a stat on
each cached entry to ensure that the file has not been updated since it was cache in APC. This incurs a system call
for every autoloaded class required by a PHP script (you can see this for yourself by running strace on your
application).
You can tell APC to not stat each cached file by setting apc.stat=0 in you apc.ini file. This change will generally
improve the overall performance of APC, but it will require you to explicitly clear the APC cache when a cached file
should be updated. This can be accomplished with Apache by issuing a hard or graceful restart. This restart step
could be added as part of the deployment process of your application.
You can run the following command on Amazon Linux to set apc.stat to 0:
sed -i "s/apc.stat=1/apc.stat=0/g" /etc/php.d/apc.ini
Performance Guide
43