search
HomeBackend DevelopmentPHP TutorialInstall and configure eaccelerator-0.9.5 to accelerate PHP-5.2.1

Install and configure eaccelerator-0.9.5 to accelerate PHP-5.2.1

Oct 15, 2019 am 09:50 AM
eacceleratorzendoptimizeroptimizationaccelerate

Operating system: Linux

1. Install eaccelerator-0.9.5 (also supports ZendOptimizer-3.2.2)

1. First install ZendOptimizer -3.2.2

  # wget http://www.vista.ac.cn/linux/down/ZendOptimizer/ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
  # tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
  # cd ZendOptimizer-3.2.2-linux-glibc21-i386
  # ./install.sh

In Please specify the location for installing ZendOptimizer: enter the ZendOptimizer installation path after the prompt, for example /data/webserver/zend

In Confirm the location of your php.ini file: prompt and enter the directory where the php.ini file is located, such as /data/webserver/php/etc

. In Specify the full path to the Apache control utility (apachectl): prompt and enter apachectl absolute Path, such as /data/webserver/apache/bin/apachectl

2. Install eaccelerator-0.9.5 acceleration software (recommended learning: PHP video tutorial)

  # wget http://www.vista.ac.cn/linux/down/eaccelerator/eaccelerator-0.9.5.tar.bz2
  # tar jxvf eaccelerator-0.9.5.tar.bz2
  # cd eaccelerator-0.9.5

Specify the path where php is located:

  # export PHP_PREFIX="/data/webserver/php"
  # $PHP_PREFIX/bin/phpize
  # ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
  # make
  # make install

At this time, eaccelerator will be installed in the php directory, and the screen will display the path where eaccelerator.so is located, for example:

Installing shared extensions: /data/webserver/php/lib/php/extensions/no-debug-zts-20060613/

Remember this path.

Eaccelerator can be installed as a PHP extension or as a zend extension. The following installation is a PHP extension.

If the /etc/php.d directory exists, you need to copy eaccelerator.ini to the directory and then modify the default value. If it does not exist, modify php.ini and add the following content before [zend] (note: it must be placed before [zend]):

[eaccelerator]
  extension="/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"
  eaccelerator.shm_size="32"
  eaccelerator.cache_dir="/data/cache/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"

Create a cache directory:

    # mkdir -p /data/cache/eaccelerator
  # chmod 0777 /data/cache/eaccelerator

Restart Apache:

 # service httpd restart

3. Check whether ZendOptimizer and eaccelerator are installed successfully

Create a phpinfo.php file with the following content:

  <?php
      phpinfo();
  ?>

Place the file in Website directory, access it in the browser, if the following content appears, the installation is successful:

  This program makes use of the Zend Scripting Language Engine:
  Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
      with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
      with Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend Technologies

2. Detailed explanation of eaccelerator configuration information (translated according to the official English description)

extension="/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"

Explanation: The path of the PHP extension eaccelerator.so.

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

eaccelerator.shm_size="32"

Explanation: The size of shared memory that can be used by eaccelerator (unit for MB).

Under Linux, the maximum memory usage of a single process is limited by the number (in bytes) set in /proc/sys/kernel/shmmax. For example, the default shmmax value of CentOS 4.4 is 33554432 bytes ( 33554432bytes/1024/1024=32MB).

Temporarily change the value:

# echo 字节数 > /proc/sys/kernel/shmmax

Follow the above method and the value will be automatically restored each time the system is restarted. If you want to make permanent changes, you can modify the /etc/sysctl.conf file and set:

  kernel.shmmax = 字节数

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

  eaccelerator.cache_dir="/data/cache/eaccelerator"

Explanation: For the cache path, you can use the command mkdir -p /data/cache/eaccelerator to create the directory, and then use the command chmod 0777 /data/cache/eaccelerator to set the directory permissions to 0777

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

    eaccelerator.enable="1"

Explanation: Turn on or off eaccelerator. "1" means on, "0" means off. The default value is "1".

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

  eaccelerator.optimizer="1"

Explanation: Turn on or off code optimization. Turning on can speed up the execution of the code. speed. "1" means on, "0" means off. The default value is "1".

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

  eaccelerator.check_mtime="1"

Explanation: When this item is turned on, eaccelerator will Check the modification time of the php file to see if it has been modified. This will take a while. If the php file has been modified, eaccelerator will recompile and cache the php file. When this option is turned off, if the PHP file is modified, the eaccelerator cache needs to be manually deleted before the modified PHP file can be displayed. "1" means on, "0" means off. The default value is "1".

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

  eaccelerator.debug="0"

Explanation: Turn on or off debugging logging. When turned on, eaccelerator will log every request for a cache file. Turning this on is only beneficial when debugging whether the eaccelerator has bugs. "1" means on, "0" means off. The default value is "0".

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

  eaccelerator.filter=""

Explanation: Determine which PHP files should be cached. You can specify a range (such as "*.php *.phtml"), so that the specified files will be cached. If the range begins with !, the specified file will not be cached. The default value is "", which means to cache all PHP files.

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

  eaccelerator.shm_max="0"

Explanation: A user can use a function such as eaccelerator_put to share Maximum data loaded in memory. The default value is "0", which means no limit. (Unit is bytes)

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

  eaccelerator.shm_ttl="0"

Explanation: When there is not enough free sharing When memory attempts to buffer a new script, files that have not been accessed for at least shm_ttl seconds ago will be deleted. The default value is "0", which means no attempt will be made to remove any old scripts from shared memory. (Unit is seconds)

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

  eaccelerator.shm_prune_period="0"

解释:当没有足够的空闲共享内存去尝试缓冲一个新脚本时,将删所有旧脚本,前提是这个尝试在超过shm_prune_period秒之前被执行过。默认值为"0",表示不尝试从共享内存中删除任何旧的脚本。(单位为秒)

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

  eaccelerator.shm_only="0"

解释:打开或者关闭在磁盘上缓存编译过的脚本。这个参数对会话数据和内容缓存没有效果。默认值为"0",表示使用磁盘和共享内存来缓存。

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

  eaccelerator.compress="1"

解释:打开或者关闭缓存内容压缩。"1"指打开,"0"指关闭。默认值为"1"。

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

  eaccelerator.compress_level="9"

解释:内存压缩的级别。默认值为"9",表示最大压缩。

  参考资料:

  1、Installing from source (http://www.eaccelerator.net/wiki/InstallFromSource)

  2、eAccelerator settings (http://www.eaccelerator.net/wiki/Settings)

The above is the detailed content of Install and configure eaccelerator-0.9.5 to accelerate PHP-5.2.1. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:zyan.cc. If there is any infringement, please contact admin@php.cn delete
What is dependency injection in PHP?What is dependency injection in PHP?May 07, 2025 pm 03:09 PM

DependencyinjectioninPHPisadesignpatternthatenhancesflexibility,testability,andmaintainabilitybyprovidingexternaldependenciestoclasses.Itallowsforloosecoupling,easiertestingthroughmocking,andmodulardesign,butrequirescarefulstructuringtoavoidover-inje

Best PHP Performance Optimization TechniquesBest PHP Performance Optimization TechniquesMay 07, 2025 pm 03:05 PM

PHP performance optimization can be achieved through the following steps: 1) use require_once or include_once on the top of the script to reduce the number of file loads; 2) use preprocessing statements and batch processing to reduce the number of database queries; 3) configure OPcache for opcode cache; 4) enable and configure PHP-FPM optimization process management; 5) use CDN to distribute static resources; 6) use Xdebug or Blackfire for code performance analysis; 7) select efficient data structures such as arrays; 8) write modular code for optimization execution.

PHP Performance Optimization: Using Opcode CachingPHP Performance Optimization: Using Opcode CachingMay 07, 2025 pm 02:49 PM

OpcodecachingsignificantlyimprovesPHPperformancebycachingcompiledcode,reducingserverloadandresponsetimes.1)ItstorescompiledPHPcodeinmemory,bypassingparsingandcompiling.2)UseOPcachebysettingparametersinphp.ini,likememoryconsumptionandscriptlimits.3)Ad

PHP Dependency Injection: Boost Code MaintainabilityPHP Dependency Injection: Boost Code MaintainabilityMay 07, 2025 pm 02:37 PM

Dependency injection provides object dependencies through external injection in PHP, improving the maintainability and flexibility of the code. Its implementation methods include: 1. Constructor injection, 2. Set value injection, 3. Interface injection. Using dependency injection can decouple, improve testability and flexibility, but attention should be paid to the possibility of increasing complexity and performance overhead.

How to Implement Dependency Injection in PHPHow to Implement Dependency Injection in PHPMay 07, 2025 pm 02:33 PM

Implementing dependency injection (DI) in PHP can be done by manual injection or using DI containers. 1) Manual injection passes dependencies through constructors, such as the UserService class injecting Logger. 2) Use DI containers to automatically manage dependencies, such as the Container class to manage Logger and UserService. Implementing DI can improve code flexibility and testability, but you need to pay attention to traps such as overinjection and service locator anti-mode.

What is the difference between unset() and session_destroy()?What is the difference between unset() and session_destroy()?May 04, 2025 am 12:19 AM

Thedifferencebetweenunset()andsession_destroy()isthatunset()clearsspecificsessionvariableswhilekeepingthesessionactive,whereassession_destroy()terminatestheentiresession.1)Useunset()toremovespecificsessionvariableswithoutaffectingthesession'soveralls

What is sticky sessions (session affinity) in the context of load balancing?What is sticky sessions (session affinity) in the context of load balancing?May 04, 2025 am 12:16 AM

Stickysessionsensureuserrequestsareroutedtothesameserverforsessiondataconsistency.1)SessionIdentificationassignsuserstoserversusingcookiesorURLmodifications.2)ConsistentRoutingdirectssubsequentrequeststothesameserver.3)LoadBalancingdistributesnewuser

What are the different session save handlers available in PHP?What are the different session save handlers available in PHP?May 04, 2025 am 12:14 AM

PHPoffersvarioussessionsavehandlers:1)Files:Default,simplebutmaybottleneckonhigh-trafficsites.2)Memcached:High-performance,idealforspeed-criticalapplications.3)Redis:SimilartoMemcached,withaddedpersistence.4)Databases:Offerscontrol,usefulforintegrati

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.