[Highlights] PHP extension [xhprof, eaccelerator]

Source: Internet
Author: User
Tags pkill
[Summary] PHP extension [xhprof, eaccelerator] Environment 1. PHP5.3.8, fastcgi installation, installation directory/usr/local/php2.CentOS5.5? Xhprofgenerate xhprof.sow.unzip-oxhprof-0.9.2.zip # cdxhprof-0.9 [summary] PHP extension [xhprof, eaccelerator]
Environment

1. PHP 5.3.8, fastcgi installation, installation 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 under extension_dir of php, configure php. ini, and restart php.

// Put it in the extension_dir directory of php... // Configure 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 whether xhprof is successfully installed ...?

Move xhprof_lib and xhprof_html to the website directory

...

Write php code and use the 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 under extension_dir of php, configure php. ini, and restart php.

// Put it in the extension_dir directory of php... // Configure php. ini # vi/usr/local/php/lib/php. ini --- [eaccelerator] extension = "eaccelerator. so "eaccelerator. shm_size = "32" 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 // view phpinfo, check whether eaccelerator is successfully installed...

?

Detailed eaccelerator configuration instructions

This is reproduced, hereby explain, reproduced 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 ". it can be adjusted according to the actual situation of the server. 16, 32, and 64,128 are acceptable.

Eaccelerator. cache_dir = "/home/php/tmp"
This directory is used for disk cache. here, eAccelerator stores pre-compiled code, process data, content, and user-defined content. the same data can also be stored in the shared memory (this can increase the access speed ). the default value is "/tmp/eaccelerator ".

Eaccelerator. enable = "1"
Enable or disable eAccelerator. "1" is enabled, and "0" is disabled. The default value is "1 ".

Eaccelerator. optimizer = "1"
Enable or disable the internal Optimizer to speed up code execution. "1" is enabled, and "0" is disabled. The default value is "1 ".

Eaccelerator. check_mtime = "1"
Open or close the PHP file modification check. "1" indicates opening, "0" indicates closing. if you re-compile the PHP file after modification, you should set it to "1 ". the default value is "1 ".

Eaccelerator. debug = "0"
Enable or disable debugging logging. "1" is enabled, and "0" is disabled. The default value is "0 ". Logs will be written to the cache hit records.

Eaccelerator. filter = ""
Determine which PHP files must be cached. You can specify cache and non-cache file types (such as "*. php *. phtml)
If the parameter is set "! ", Files matching these parameters are ignored. The default value is "", that is, all PHP files will be cached.

Eaccelerator. shm_max = "0"
When the "eaccelerator_put ()" function is used, it is prohibited to store excessive files in the shared memory. This parameter specifies the maximum value that can be stored, in bytes (10240, 10 K, 1 M ). "0" is unlimited. The default value is "0 ".

Eaccelerator. shm_ttl = "0"
When the eAccelerator fails to obtain the shared memory size of the new script, it will delete all script caches that have not been accessed in the last "shm_ttl" seconds from the shared memory. The default value is "0". that is, no cached files are deleted from the shared files in the spring.

Eaccelerator. shm_prune_period = "0"
When the eAccelerator fails to get the shared memory size of the new script, it will try to delete the cache script earlier than "shm_prune_period" from the shared memory. The default value is "0". that is, no cached files are deleted from the shared files in the spring.

Eaccelerator. shm_only = "0"
Allow or disable caching compiled scripts on disks. This option is invalid for session data and content caching. The default value is "0", that is, the disk and shared memory are used for cache.

Eaccelerator. compress = "1"
Allows or disables content caching. The default value is "1", that is, compression is allowed.

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 the location where the content cache is stored. you can set it:
Shm_and_diskIn shared cache and hard disk (default)
ShmShared memory exists by default. if the shared memory is full or the size exceeds the value of "eaccelerator. shm_max", it is saved to the hard disk.
Shm_onlyStored only in shared memory
Disk_onlyStored only on hard disk
NoneNo data cache

Eaccelerator. allowed_admin_path = "/var/www/html/21andy.com/eaccelerator"
This is the control panel address.
The installation package contains control. php. you can copy it to any directory on the website and use it to view and manage it. this must be specified. Otherwise, an error occurs when you view the cached content.

---

?

Related Article

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.