You can extract the maximum performance from your web server by using using PHP's APC module, which caches php opcode instead of forcing PHP to reinterpret every script every time it is executed, says Vincent Danen Vincent provides an example with code and explains that the important options to note, besides enabling APC, are the apc.ttl and apc.user_ttl options, which define the time for a script to remain in the cache, in seconds. This is really important for a server that serves a lot of files, since it prevents the cache from filling up with stale entries that could prevent newer entries from being cached. You could also tweak the apc.num_files_hint, which gives APC an approximation of the number of distinct PHP source files that will be requested or included on your system. The default here is 1000, but if you serve many more files than that, increase the number to a best-guess estimate. Likewise, if you have a lot less files than that, reduce the number accordingly, Vincent writes.
The source package for APC also includes a script apc.php, which can be used to obtain detailed statistics from the APC cache to allow you to further tweak the APC settings. Edit the script and change the ADMIN_PASSWORD option in order to use it. By tweaking the options and using this script to determine how well your changes are taking place, you can give your PHP scripts a nice performance boost, Vincent concludes.





