eaccelerator安装配置PHP加速
eAccelerator简介
eAccelerator是一个的免费、开源的PHP模块,它能够为提供PHP加速、优化、加码、和动态内容缓存功能。它通过存储PHP脚本编译后的状态而加快执行PHP脚本的速度,而不需要频繁的编译这个PHP脚本。而且它能优化PHP脚本,以提高执行PHP的速度。eAccelerator特色是减少了服务器负载、使PHP脚本加速1-10倍。
下载地址:http://sourceforge.net/projects/eaccelerator/
解压修改源代码(解决出现open_basedir等报错)
# tar jxvf eaccelerator-0.9.6.tar.bz2 # cd eaccelerator-0.9.6/ # vi eaccelerator.c
找到以下:
if (PG(open_basedir) && php_check_open_basedir(realname TSRMLS_CC)) {
改为
if (PG(open_basedir) && php_check_open_basedir(file_handle->filename TSRMLS_CC)) {
编译安装扩展eaccelerator
# /usr/local/php-5.2.14/bin/phpize # 对应你自己的phpize,一定要在eaccelerator-0.9.6目录执行 # ./configure –enable-eaccelerator \ –with-php-config=/usr/local/php-5.2.14/bin/php-config # make # make install # 会提示你扩展装到了哪个目录,我这边是/usr/local/php-5.2.14/lib/php/extensions/no-debug-non-zts-20060613/
配置php.ini
如果本机之前有加过扩展,直接跳到下一步“添加eacclerator扩展”
Vi /usr/local/php-5.2.14/etc/php.ini
将
extension_dir = ./
替换成
extension_dir=/usr/local/php-5.2.14/lib/php/extensions/no-debug-non-zts-20060613/
添加eacclerator扩展
# vi /usr/local/php-5.2.14/etc/php.ini
增加如下内容
[eaccelerator] extension=eaccelerator.so eaccelerator.shm_size=”16″ eaccelerator.cache_dir=”/tmp/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″
创建eaccelerator目录
# mkdir /tmp /eaccelerator # chmod 777 /tmp/eaccelerator
重启测试
重启apache或者nginx,并且查看效果,如果/tmp/eaccelerator下有目录,说明安装成功了。
配置参数详解(eaccelerator)
eaccelerator.shm_size=”8″
eaccelerator.cache_dir=”/tmp/eaccelerator ”
这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 “/tmp/eaccelerator”.
eaccelerator.enable=”1″
开启或关闭 eAccelerator。“1” 为开启,“0” 为关闭。默认值为 “1”。
eaccelerator.optimizer=”1″
启或关闭内部优化器,可以提升代码执行速度。“1” 为开启,“0” 为关闭。默认值为 “1”。
eaccelerator.check_mtime=”1″
打开或者关闭 PHP 的文件修改检查. “1” 是指打开, “0” 是指关闭. 如果您在修改以后重新编译 PHP 的文件,那么您应当设置为 “1”. 默认值是 “1”.
eaccelerator.debug=”0″
开启或关闭调试日志记录。“1” 为开启,“0” 为关闭。默认值为 “0”。会将缓存命中得记录写入日志。
eaccelerator.filter=””
判断哪些 PHP 文件必须缓存。您可以指定缓存和不缓存的文件类型(如 “*.php *.phtml”等),如果参数以 “!” 开头,则匹配这些参数的文件被忽略缓存。默认值为 “”,即,所有 PHP 文件都将被缓存。
eaccelerator.shm_max=”0″
当使用 ” eaccelerator_put() ” 函数时禁止其向共享内存中存储过大的文件。该参数指定允许存储的最大值,单位:字节 (10240, 10K, 1M)。“0” 为不限制。默认值为 “0”。
eaccelerator.shm_ttl=”0″
当eAccelerator 获取新脚本的共享内存大小失败时,它将从共享内存中删除所有在最后 “shm_ttl” 秒内没有存取的脚本缓存。默认值为 “0”,即:不从共享内春中删除任何缓存文件。
eaccelerator.shm_prune_period=”0″
当eAccelerator 获取新脚本的共享内存大小失败时,他将试图从共享内存中删除早于“shm_prune_period” 秒的缓存脚本。默认值为 “0”,即:不从共享内春中删除任何缓存文件。
eaccelerator.shm_only=”0″
允许或禁止将已编译脚本缓存在磁盘上。该选项对 session 数据和内容缓存无效。默认值为 “0”,即:使用磁盘和共享内存进行缓存。
eaccelerator.compress=”1″
允许或禁止压缩内容缓存。默认值为 “1”,即:允许压缩。
eaccelerator.compress_level=”9″
指定内容缓存的压缩等级。默认值为 “9”,为最高等级。
eaccelerator.keys = “disk_only” eaccelerator.session = “disk_only” eaccelerator.content = “disk_only”
设置内容缓存的存放的地方,可以设置为:
- shm_and_disk 在共享缓存和硬盘(默认值)
- shm 默认存在共享内存,如果共享内存已满或大小超过 “eaccelerator.shm_max” 的值,就存到硬盘
- shm_only 只存放在共享内存
- disk_only 只存放在硬盘
- none 不缓存数据
PHP扩展xcache安装
xcache模块可以缓存php运行时编译生成的opcode可以加速php程序的效率,安装xcache和安装memcache方法类似,都是以扩展的方式安装,PHP任何扩展方法基本上都是如下,所以不需要特意去找xxx扩展的文档.
安装PHP扩展xcache
# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz # tar -xvf xcache-3.2.0.tar.gz # cd xcache-3.2.0 # ./configure –with-php-config=/usr/local/php/bin/php-config –enable-xcache # make && make install
会生成类似如下信息
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
所有的模块都会生成到这个目录下
编辑php配置文件
# vim /usr/local/php/etc/php.ini extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so
重载PHP
# service php-fpm reload
如果是你Apache+PHP模式,那么重启Apache即可.
# service httpd restart
或者
# /usr/local/apache-2.2.27/bin/apachectl restart
测试结果

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software