Methods for php-accelerator website to accelerate PHP buffering_PHP tutorial

WBOY
Release: 2016-07-21 15:50:36
Original
934 people have browsed it

http://php-accelerator.co.uk/ can be downloaded and is a strong opponent of zend. It's free. I'm already using it. The effect is not bad.
Modify PHP.ini and add:
zend_extension = /usr/local/lib/php_accelerator_1.3.3r2.so
phpa = on
phpa.tweaks = on
phpa.cache_dir = / tmp
phpa.file_perms = 400
phpa.cache_file_prune_period = 1h
phpa.cache_file_ttl = 1d
phpa.shm_size = 10
phpa.shm_key = 0xc0deb00
phpa.shm_per ms = 666
phpa.shm_user = nobody
phpa.shm_group = nobody
phpa.shm_release_at_exit = on
phpa.shm_stats_check_period = 5m
phpa.shm_ttl = 12h
phpa.shm_max_processes = 5 12
phpa.shm_lock_threshold0 = 10

apachectl graceful will work. See its documentation for specific parameters.


We have explained several methods of acceleration in the article "LAMP Acceleration", among which we mentioned PHP Accelerator. Its installation method is very simple, but you need to go to its website to obtain an activation key. .

1. Download:
www.php-accelerator.co.uk/download.php

2. Get the activation key and install:

www.php- accelerator.co.uk/activate.php
After registering your SERVER_NAME, you will get the following prompt:
Your key for www.freelamp.com is 8edfd13946c96309244fcca309415902
Now you must set the key for www. freelamp.com in your site configuration.
For single domains not using virtual hosts
The key can be set in the php.ini file as follows:
# PHPA key for www.freelamp.com
#
phpa.registration_key = 8edfd13946c96309244fcca309415902
For domains setup as a virtual host
Add the key to the domain specific section for your web server.
# www .freelamp.com VHost entry
 #
 < VirtualHost 10.20.30.40>
ServerName www.freelamp.com
244fcca309415902
# also enable phpa if set to off in the php.ini (the default is on)
php_value phpa 1
The configuration of the CONFIGURATION file.

Since most websites are configured with virtual hosts, it is recommended to use php_value phpa.

For example:

php_value phpa.tweaks off
php_value phpa.cache_dir /tmp
php_value phpa.file_perms 400
php_value phpa.ignore_files "/index.php, / a/test.php"
 # php_value phpa.ignore_dirs "/data/WWW/site1/,/cache/"
 php_value phpa.shm_size 8
 php_value phpa.shm_key 0xc0deb00
 php_value phpa.shm_perms 664

3. Setting php.ini

Suppose we unzip the downloaded file to /usr/local/php, then add:

to php.ini zend_extension=/usr/local/php/php_accelerator_1.2p2.so

And comment out the original Zend optimization engine:

# zend_extension=/usr/local/Zend/lib/ZendOptimizer.so

Restart Apache and browse any PHP page with a browser. You can see that some files starting with phpa are generated under /tmp. Another way to check whether buffering is working is to look at the output of phpinfo(). The description part of the original Zend optimization engine has been displayed as:

This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies
with the PHP Accelerator v1.2p2, Copyright (c) 2001-2002, by Nick Lindridge

It should be noted that the installation According to the INSTALL installation instructions, the .so file is different from the real .so file, so you need to pay attention to this difference when installing.

4. Adjust the buffer size

PHP Accelerator provides buffer management commands:
phpa_cache_admin -mv observes the buffering situation of the memory
phpa_cache_admin -fv observes the buffering situation of the file
phpa_cache_admin -k Set buffer size

5. Summary

The INSTALL file provided by the software explains some opinions about performance, and I will not go into details here.

It should be noted that FreeLAMP.com’s articles are currently not PHP-based, but the forum system is PHP-based, so the performance improvement will only be an improvement in the forum system.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319337.htmlTechArticlehttp://php-accelerator.co.uk/ can be downloaded and is a strong opponent of zend. It's free. I'm already using it. The effect is not bad. Modify PHP.ini and add: zend_extension=/usr/local/lib/php_...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template