Установка eAccelerator (замена Turck MMCache)

confguru

ExAdmin
Команда форума
Установка eAccelerator (замена Turck MMCache)

HOW-TO: Install Eaccelerator (Turck MMCache replacement)

--------------------------------------------------------------------------------

Updated to Eaccelerator 0.9.2a

Eaccelerator is a further development from mmcache PHP Accelerator & Encoder. It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated.

The instructions in this How-To is a bit different to the official one, because the directories are a bit different - I couldn't get this to work using the instructions from the official guide itself. I also point to the module file in a different directory in php.ini - the default one in the official instructions didn't work for me.

NOTE: I couldn't get mmcache to work with PHP 4.3.11 as well. eaccelerator works.

Follow the instructions to install or to upgrade from mmcache.


Installation:

Upgrade instructions are the same as installation. Note the lines in red which are different to previous instructions.


NOTE: Each time you upgrade PHP, you need to COMPLETELY REINSTALL eaccelerator BY DELETING THE WHOLE eaccelerator DIRECTORY, AND UNTARRING A NEW eaccelerator DIRECTORY!

1) Login as root in SSH

2) Run the following commands in the following order:

cd /

mkdir ea

cd ea

wget http://optusnet.dl.sourceforge.net/eaccelerator-0.9.2a.tar.gz

tar xvzf eaccelerator-0.9.2a.tar.gz

cd eaccelerator

export PHP_PREFIX="/usr"

$PHP_PREFIX/bin/phpize

./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config

make

make install

3) Edit php.ini - usually it's /etc/php.ini or /usr/local/lib/php.ini

Find this:

;Windows Extensions

Above this, comment out or remove the PHPA or mmcache lines if you have them. Replace them with this:

To install as a ZEND extension:

zend_extension="/ea/eaccelerator/modules/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

OR to install as a PHP extension:

extension="/ea/eaccelerator/modules/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

4) Create the cache directory by doing the following at the command line

mkdir /tmp/eaccelerator

chmod 0777 /tmp/eaccelerator


5) Restart Apache

service httpd restart

Done!

6) Optional - upload ea.php file

I modified the eaccelerator.php file so that only you can control the eaccelerator config and see the stats.

Edit ea.php - change 1 to your userid.

Upload to your forum directory.

When you link to ea.php you can see your eaccelerator stats like this:

eAccelerator 0.9.2

eAccelerator support enabled
Caching Enabled true
Optimizer Enabled true
Memory Size 33,554,396 Bytes
Memory Available 22,675,372 Bytes
Memory Allocated 10,879,024 Bytes
Cached Scripts 101
Removed Scripts 0
Cached Keys 0
 

Net.Ru

Новичок
Только вот так - chmod 0777 /tmp/eaccelerator - делать очень нежелательно. Если пользователей несколько - потенциальная дыра в безопасности.

В идеале, chmod 0700, ну если не будет работать, то хотя бы chmod 1777.
 

slach

Новичок
еще бы кто догадался win32 бинарники выложить... но видимо не судьба =)
хотя вот Turck спокойно под win32 шел
 

C@L!P$!O

Guest
Как в кратце, работеет ето. (кроме того что он кеширует все запросы)

И каой в среднем прерост производительности?
 

alexhemp

Новичок
C@L!P$!O

Почитай описание. Это кэш байт-кода. Скрипты компилируются один раз.

Выигрыш в скорости зависит от конкретного скрипта, для маленьких скриптов использующих большие библиотеки вполне приличный прирост.
 
Сверху