How to setup php5 and eAccelerator on a cpanel/RHEL server
To install/upgrade php5 on cpanel server
(see: http://forums.cpanel.net/showthread.php?t=37728)
The steps were:
cd /usr/lib/mysql
rename .a .a_old *.a
rename .la .la_old *.laThen run /scripts/easyapache
Then rename these files back.
cd /usr/lib/mysql
rename .a_old .a *.a_old
rename .la_old .la *.la_oldTo install eAccellerator:
(see: http://forum.ev1servers.net/showthread.php?t=54479)
up2date php-devel
cd /root
wget http://cogent.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0...
tar -xvzf eaccelerator-0.9.3.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
php eaccelerator_password.php
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
cp /root/eaccelerator*/eaccelerator.php /usr/local/apache/htdocs/Edit /usr/local/lib/php.ini
- Find the following at approximately the middle of the file:
Code:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
Add this: (use the password hash generated by 'php eaccelerator_password.php' above)
Code:
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20041030/eaccelerator.so"
eaccelerator.shm_size="32"
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="3600"
eaccelerator.shm_prune_period="180"
eaccelerator.shm_only="1"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.admin.name="your_admin_name"
eaccelerator.admin.password="your_admin_password_hash"Re-start httpd
/etc/init.d/httpd restartMake sure it's working.
Go to http://your-server-domain-or-ip/phpinfo.php and look for "Zend Technologies with eAccelerator" in the credits, and an eAccelerator section.
Go to http://your-server-domain-or-ip/eaccelerator.php and see your cache info and options.
*** Notes ***
Q: Apache: How can i disable eaccelerator on a particular virtualhost ?
A: Just put php_flag eaccelerator.enable 0 and php_flag eaccelerator.optimizer 0 in a .htaccess file in the document root of the virtualhost or directly inside <Virtualhost> apache section.
eAccelerator Configuration Options (used in php.ini)
---------------------
eaccelerator.shm_size
The amount of shared memory (in megabytes) that eAccelerator will use.
"0" means OS default. Default value is "0".
eaccelerator.cache_dir
The directory that is used for disk cache. eAccelerator stores precompiled
code, session data, content and user entries here. The same data can be
stored in shared memory also (for more quick access). Default value is
"/tmp/eaccelerator".
eaccelerator.enable
Enables or disables eAccelerator. Should be "1" for enabling or "0" for
disabling. Default value is "1".
eaccelerator.optimizer
Enables or disables internal peephole optimizer which may speed up code
execution. Should be "1" for enabling or "0" for disabling. Default value
is "1".
eaccelerator.debug
Enables or disables debug logging. Should be "1" for enabling or "0" for
disabling. Default value is "0".
eaccelerator.check_mtime
Enables or disables PHP file modification checking . Should be "1" for
enabling or "0" for disabling. You should set it to "1" if you want to
recompile PHP files after modification. Default value is "1".
eaccelerator.filter
Determine which PHP files must be cached. You may specify the number of
patterns (for example "*.php *.phtml") which specifies to cache or not to
cache. If pattern starts with the character "!", it means to ignore files
which are matched by the following pattern. Default value is "" that means
all PHP scripts will be cached.
eaccelerator.shm_max
Disables putting large values into shared memory by " eaccelerator_put() "
function. It indicates the largest allowed size in bytes (10240, 10K, 1M).
The "0" disables the limit. Default value is "0".
eaccelerator.shm_ttl
When eaccelerator fails to get shared memory for new script it removes all
scripts which were not accessed at last "shm_ttl" seconds from shared
memory. Default value is "0" that means - don't remove any files from
shared memory.
eaccelerator.shm_prune_period
When eaccelerator fails to get shared memory for new script it tryes to
remove old script if the previous try was made more then
"shm_prune_period" seconds ago. Default value is "0" that means - don't
try to remove any files from shared memory.
eaccelerator.shm_only
Enables or disables caching of compiled scripts on disk. It has no effect
on session data and content caching. Default value is "0" that means - use
disk and shared memory for caching.
eaccelerator.compress
Enables or disables cached content compression. Default value is "1" that
means enable compression.
eaccelerator.compress_level
Compression level used for content caching. Default value is "9" which is
the maximum value
eaccelerator.keys
eaccelerator.sessions
eaccelerator.content
Determine where keys, session data and content will be cached. The possible
values are:
"shm_and_disk" - cache data in shared memory and on disk (default value)
"shm" - cache data in shared memory or on disk if shared memory
is full or data size greater then "eaccelerator.shm_max"
"shm_only" - cache data in shared memory
"disk_only" - cache data on disk
"none" - don't cache data
