FreeBSD. Installing and Configuring eAccelerator
eAccelerator is a freely distributed PHP accelerator, optimizer, and dynamic content caching tool. It improves the performance of PHP scripts by caching them in a compiled state, thereby preventing them from being recompiled repeatedly. Optimizing the scripts increases their execution speed.
eAccelerator usually reduces server load and speeds up PHP code execution by a factor of 1–10.
Installation
Let’s use installation through the ports system. It’s a good idea to update the ports using portsnap!
Here we go,
cd /usr/ports/www/eaccelerator
make install clean
Configuration
Let’s create a cache directory:
mkdir /tmp/eaccelerator
chmod 775 /tmp/eaccelerator
Let’s create a log file:
touch /var/log/eaccelerator_log
chmod 775 /var/log/eaccelerator_log
Let’s edit php.ini
vi /usr/local/etc/php.ini
And add the following:
[eAccelerator]
; Подключаем модуль
extension="eaccelerator.so"
; Размер кеша, в МБ
eaccelerator.shm_size="16"
; Путь до каталога файлов кеша
eaccelerator.cache_dir="/tmp/eaccelerator"
; Переключатель модуля (1 - вкл и 0 - выкл)
eaccelerator.enable="1"
; Переключатель оптимизатора (1 - вкл и 0 - выкл)
eaccelerator.optimizer="1"
; Добавляет отладочную информацию в лог (1 - вкл и 0 - выкл)
eaccelerator.debug="0"
; Путь до файла лога
eaccelerator.log_file = "/var/log/eaccelerator_log"
; Проверять время модификации файлов кеша для перекомпиляции оных (1 - вкл и 0 - выкл)
eaccelerator.check_mtime="1"
; Фильтр расширений файлов которых надо кешировать. Например, "*.php *.phtml".
eaccelerator.filter=""
; Размер выделяемой памяти, в байтах. Допустимо вводить в формате 10240, 10K, 1M и т.д. При 0 - безлимит
eaccelerator.shm_max="0"
; Время жизни кеша, сек
eaccelerator.shm_ttl="120"
; Период удаления старых данных из памяти, сек (при 0 не удаляет)
eaccelerator.shm_prune_period="0"
; Использовать для кеша только память. При 0 используется диск и память
eaccelerator.shm_only="0"
; Переключатель компресии (1 - вкл и 0 - выкл)
eaccelerator.compress="1"
; Степень сжатия
eaccelerator.compress_level="9"
Let’s restart Apache:
apachectl restart
That’s it, caching is working!
Additional settings are available here in English.
Comments are closed. Read the original discussion in Russian →