PHP Accelerator

PHP Accelerator is an easily installed PHP Zend engine extension that provides a PHP cache, and is capable of delivering a substantial acceleration of PHP scripts without requiring any script changes, loss of dynamic content, or other application compromises.

  1. Installation:
    • Download PHPAccelerator.
    • Unpackage it and move contents to "/usr/local/phpaccelerator".
    • Include the below line to php.ini under dynamic extension section:
          zend_extension="/usr/local/phpaccelerator/php_accelerator_1.3.3r2.so"
          
    • Restart httpd process
  2. Testing:
    • Create and execute the below script:
           <?  
               var_dump($GLOBALS['_PHPA']);
           ?>
          
    • If PHPA is installed then there should be output, and if enabled, you should see output similar to the following:
          array(3) { ["ENABLED"]=>  bool(true) ["iVERSION"]=>  int(10303) ["VERSION"]=>  string(7) "1.3.3r2" }
          
    • You can also check if it works at:
          http://www.rexswain.com/httpview.html
          

      Enter the url of a php page on your server. The header information should show "X-Accelerated-By:·PHPA/1.3.3r2

  3. Configurations:
    • All configurations set by default should be good. However, you may need to adjust the shared memory cache size. This defaults to 8MB, but can be set to any value in 1MB increments up to the limit for a single shared memory segment (32MB is common).
        phpa.shm_size = 32
        
    • To access the memory usage, you will need to add the user and group that apache runs as to the "php.ini" file and restart apache.
          phpa.shm_user = apacheuser
          phpa.shm_group = apachegroup
          
    • You should see output of `phpa_cache_admin -mv` similar to the following:
          shm size 8.0MB bytes
          mempool size 8.0MB
          mempool bytes allocated 947.4KB
          mempool max bytes allocated 961.8KB
          mempool bytes free 7.0MB
          mempool overhead 42.2KB
          cache enabled
          

      This says that the shared memory is 8MB, that 947KBytes is allocated now, and that the maximum ever allocated was nearly 962KBytes. From this information you might decide to reduce or increase the size of the cache. If the maximum ever allocated is nearly the same as the cache size then you should probably increase the size. 2MB more than the maximum used should
      be a comfortable setting

For more information, check out the README and CONFIGURATION files that come with the download.

Comment