"Collection" PHP extension "Xhprof,eaccelerator"

Source: Internet
Author: User
Tags configuration php pkill
"Summary" PHP extension "Xhprof,eaccelerator"

Environment

1.PHP 5.3.8, install using fastcgi mode, install directory/usr/local/php

2.CentOS 5.5

?

Xhprof

Generate xhprof.so

#unzip-o xhprof-0.9.2.zip#cd xhprof-0.9.2#cd xhprof-0.9.2/xhprof-0.9.2/extension/#/usr/local/php/bin/phpize#./ Configure--with-php-config=/usr/local/php/bin/php-config#make#make Install

Put the generated xhprof.so into PHP extension_dir, after configuring php.ini, restart PHP

Put PHP in the Extension_dir directory ...//configuration Php.ini#vi/usr/local/php/lib/php.ini---[xhprof]extension= "xhprof.so"; xhprof.output_dir= "/VAR/CACHE/XHPROF"---//restart Php#pkill-o php-fpm#/usr/local/php/sbin/php-fpm//view phpinfo, Check xhprof for installation success ...?

Move xhprof_lib,xhprof_html to the site Directory

...

Write PHP code, use XHPROF module

 
  Save_run ($xhprof _data, $identifier);    echo "View Xhprof";}
?

Eaccelerator

Generate eaccelerator.so

#tar-ZXVF EACCELERATOR-0.9.6.1.ZIP#CD Eaccelerator-0.9.6.1#/usr/local/php/bin/phpize#./configure-- With-php-config=/usr/local/php/bin/php-config#make#make Install
?

Put the generated eaccelerator.so into PHP extension_dir, after configuring php.ini, restart PHP

Put PHP in the Extension_dir directory ...    Configure PHP.ini  #vi/usr/local/php/lib/php.ini  ---  [eaccelerator]extension= "eaccelerator.so" Eaccelerator.shm_size= "+" eaccelerator.cache_dir= "/tmp" 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= "3600" eaccelerator.shm_only= "0" eaccelerator.compress= "1" eaccelerator.compress_level= "9" Eaccelerator.keys = "disk_only" eaccelerator.sessions = "Disk_only" Eaccelerator.content = "Disk_only"---    //restart PHP  #pkill-o php-fpm#/usr/local/php/sbin/php-fpm  // Check the phpinfo to see if the Eaccelerator is successfully installed ...

?

Eaccelerator Detailed Configuration Instructions

" This is reproduced, hereby stated, reprinted address: http://www.21andy.com/blog/20100207/1646.html"

---

Eaccelerator.shm_size= "32"
The amount of shared memory that Eaccelerator can use (in megabytes). "0" refers to the default value of the operating system. The default value is "0". can be adjusted according to the actual situation of the server, 16,32,64,128 are OK.

Eaccelerator.cache_dir= "/home/php/tmp"
This directory is used for disk caching. Eaccelerator stores pre-compiled code, process data, content, and user-defined content here. The same data can also be stored in shared memory (which can improve access speed). The default setting is "/tmp/eaccelerator".

eaccelerator.enable= "1"
Turn eaccelerator on or off. "1" is on, "0" is off. The default value is "1".

Eaccelerator.optimizer= "1"
Power on or off the internal optimizer to increase code execution speed. "1" is on, "0" is off. The default value is "1".

Eaccelerator.check_mtime= "1"
Open or close the PHP file modification check. "1" means open, "0" means close. If you recompile the PHP file after you modify it, you should set it to "1". The default value is "1".

eaccelerator.debug= "0"
Turn debug logging on or off. "1" is on, "0" is off. The default value is "0". Records are written to the log when the cache is hit.

Eaccelerator.filter= ""
Determine which PHP files must be cached. You can specify cached and non-cached file types (such as "*.php *.phtml", etc.)
If the argument starts with "!", the file that matches these parameters is ignored by the cache. The default value is "", that is, all PHP files will be cached.

eaccelerator.shm_max= "0"
When you use the "eaccelerator_put ()" function, it is forbidden to store too large files in shared memory. This parameter specifies the maximum value that is allowed to be stored in bytes (10240, 10K, 1M). "0" is not limited. The default value is "0".

Eaccelerator.shm_ttl= "0"
When Eaccelerator gets the shared memory size of a new script fails, it removes all script caches that were not accessed in the last "Shm_ttl" seconds from shared memory. The default value is "0", which is: Do not delete any cache files from the share inner spring.

eaccelerator.shm_prune_period= "0"
When Eaccelerator gets the shared memory size of a new script fails, he tries to remove the cache script that is older than "shm_prune_period" seconds from shared memory. The default value is "0", which is: Do not delete any cache files from the share inner spring.

eaccelerator.shm_only= "0"
Allows or disables the caching of compiled scripts on disk. This option is not valid for session data and content caching. The default value is "0", which is: Use disk and shared memory for caching.

eaccelerator.compress= "1"
Allows or disables the compression of the content cache. The default value is "1", which is: Allow compression.

Eaccelerator.compress_level= "9"
Specifies the compression level of the content cache. The default value is "9", which is the highest level.

Eaccelerator.keys = "Disk_only"
Eaccelerator.session = "Disk_only"
Eaccelerator.content = "Disk_only"
Set where the content cache is stored, which can be set to:
Shm_and_disk in shared cache and hard disk (default value)
SHM shared memory By default, if the shared memory is full or the size exceeds the value of "Eaccelerator.shm_max", it will be saved to the hard disk
shm_only only stored in shared memory
disk_only is only stored on the hard drive
None does not cache data

Eaccelerator.allowed_admin_path = "/var/www/html/21andy.com/eaccelerator"
This is the address of the control Panel.
There is a control.php in the installation package, you copy it to any directory on the website, you can use it to view and manage it, this must be specified, otherwise, when viewing the contents of the cache error

---

?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.