PHP Accelerator: Difference between revisions
adds notes |
No edit summary |
||
| Line 1: | Line 1: | ||
A [[wp:PHP_accelerator|PHP Acelerator]] is a tool that will enhance the performance of web applications written for the PHP scripting language. The free [http://php.net/apc Alternative PHP Cache] (APC) is distributed as a PEAR package. | A [[wp:PHP_accelerator|PHP Acelerator]] is a tool that will enhance the [[Performance_tuning|performance]] of web applications written for the PHP scripting language. The free [http://php.net/apc Alternative PHP Cache] (APC) is distributed as a PEAR package. | ||
If you run your own LAMP server with PHP applications, then please install it. | If you run your own LAMP server with PHP applications, then please install it. The [[Moodle]] documentation includes information on [http://docs.moodle.org/en/Installing_APC_in_Windows setting up APC]; including testing before and after performance with "[http://httpd.apache.org/docs/2.0/programs/ab.html Apache Bench]" | ||
== Installation == | == Installation == | ||
| Line 22: | Line 22: | ||
sudo ln -s /usr/share/php/apc.php | sudo ln -s /usr/share/php/apc.php | ||
</source> | </source> | ||
== MediaWiki == | |||
MediaWiki can take advantage of the APC cache if you tell it to. | |||
see [[mw:Manual:Configuration_settings#Cache|The Manual for cache settings]], and set [[mw:Manual:$wgMainCacheType]] in LocalSettings.php: | |||
<source lang="php"> | |||
$wgMainCacheType = CACHE_ACCEL; | |||
</source> | |||
== Troubleshooting == | |||
If you notice sluggishness in your site after installing APC, then check out the front-end (apc.php). The sure sign that you need to increase your cache size is that the "cache full" count is greater than one. | |||
[[Image:Apc-problems.png|200px|thumb|right|Cache is too small]] | |||
# [[Performance_tuning|Check your memory]] | |||
# Increase the Shared Memory Size for APC in your php.ini file e.g. <code>apc.shm_size = 128</code> | |||
# Restart Apache | |||
# Use the Apache Bench tool to test performance with and without APC enabled. | |||
== Notes == | == Notes == | ||
APC, aside from speeding up your website, also provides a storage mechanism outside the traditional cookie/session mechanism. So, you could set an application variable or constant and (assuming that the cache is not cleared, etc.) retrieve that value from another context. | APC, aside from speeding up your website, also provides a storage mechanism outside the traditional cookie/session mechanism. So, you could set an application variable or constant and (assuming that the cache is not cleared, etc.) retrieve that value from another context. | ||
[[Category:Apache]] | |||
[[Category:PHP]] | |||