search
HomeBackend DevelopmentPHP Tutorial微凉大大,教你一步一步在linux中正确的安装Xcache加速php。

首先,强烈吐槽,百度上的教程,都左复制右复制的,乱七八糟,缺东缺西的。借此微凉大大我提供我苦心整理好的教程。以便各位小菜能顺利的使用Xcache加速php,如果看完了,也操作了,还是失败了的话,请联系微凉大大的QQ 496928838,微凉大大也想看看你是如何一步一步都装不上。


微凉大大原创资料,转载跪求你保留好我的信息。


#第一步,下载Xcache

wget http://xcache.lighttpd.net/pub/Releases/3.1.0/xcache-3.1.0.tar.gz


#第一步非常简单,如果你下载不了就是人品问题。


#第二步,解压Xcache源码。
tar -zvxf xcache-3.1.0.tar.gz

#第二部,也是非常简单的,如果你解压不了就是人品问题。


#接下来,顺便,进入安装目录
cd xcache-3.1.0


#第三步,非常重要,基本出错都在这里。
#首先,安装前要执行phpize配置
/php的路径/bin/phpize
#请确保已经安装了php,如果没有安装php请先安装php。(费话,你不装php,装什么Xcache啊)


#接下来,配置->编译->安装,可一步到位,前提是你路径没有错误。
#配置./configure --prefix=/php的路径/lib/php/extensions \--with-php-config=/php的路径/bin/php-config \--enable-xcache#编译make#安装make install


#安装完成后,会出现类似以下提示的东西,证明安装成功。
/www/php/extensions/no-debug-non-zts-20060613/


#到这里,就算安装完成了,剩下就是配置工作。




#把xcache管理页面,移动到web目录。
cp ./htdocs /www/web/xcache -r

#./htdocs,这是在源码目录中的。别告诉我你找不到。
#/www/web/xcache,web目录,名字叫什么自己喜欢。
#当然,如果你很笨的话。用不起这个命令。那么,在解压好的源码目录中,直接通过FTP之类的工具,直接移动也是OK的。


配置php.ini,
还是在源码目录中,找到 xcache.ini , 然后直接在 php.ini 后面加就行。
#或者用以下命令,追加配置文件xcache.ini至php.ini
cat xcache.ini >> /php的路径/etc/php.ini


#如果你很笨,还是建议FTP里面操作,因为后面还要修改下管理的用户名跟密码的。。。


请注意修改xcache.ini中的属性。此时执行完上面那命令,就要编辑php.ini了。
xcache.admin.user = "admin"
xcache.admin.pass = "21232f297a57a5a743894a0e4a801fc3"
密码是admin,想改密码什么的,以你的聪明才智你懂的。
xcache.mmap_path =    "/tmp/xcache"
#这个文件建议在tmp目录咯,记得给 777 权限。
touch /tmp/xcachechmod 777 /tmp/xcache




上面都是需要注意的地方。
以下给出我配置好的xcache.ini,注释什么的我就去掉了。
要注释的请到 http://xcache.lighttpd.net/wiki/XcacheIni 这里慢慢看。。。
[xcache-common]extension = xcache.so[xcache.admin]xcache.admin.enable_auth = Onxcache.admin.user = "admin"xcache.admin.pass = "21232f297a57a5a743894a0e4a801fc3"[xcache]xcache.shm_scheme =        "mmap"xcache.size  =               128Mxcache.count =                 1xcache.slots =                8Kxcache.ttl   =                 0xcache.gc_interval =           0xcache.var_size  =            4Mxcache.var_count =             1xcache.var_slots =            8Kxcache.var_ttl   =             0xcache.var_maxttl   =          0xcache.var_gc_interval =     300xcache.var_namespace_mode =    0xcache.var_namespace =        ""xcache.readonly_protection = Offxcache.mmap_path =    "/tmp/xcache"xcache.coredump_directory =   ""xcache.coredump_type =         0xcache.disable_on_crash =    Offxcache.experimental =        Offxcache.cacher =               Onxcache.stat   =               Onxcache.optimizer =           Off[xcache.coverager]xcache.coverager =           Offxcache.coverager_autostart =  Onxcache.coveragedump_directory = ""






重启下服务器,就这么简单,如无意外就安装好了。
service httpd restart




看看phpinfo中是否有Xcache。有就证明安装成功了。


如果配置完成后,页面都打不开了。证明你php.ini中冲突了。


例如 zend optimizer,这个东西就会冲突。解决方法就是把 zend_extension 改成 Xcache定义的缓存文件中。
Statement
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
How can you prevent session fixation attacks?How can you prevent session fixation attacks?Apr 28, 2025 am 12:25 AM

Effective methods to prevent session fixed attacks include: 1. Regenerate the session ID after the user logs in; 2. Use a secure session ID generation algorithm; 3. Implement the session timeout mechanism; 4. Encrypt session data using HTTPS. These measures can ensure that the application is indestructible when facing session fixed attacks.

How do you implement sessionless authentication?How do you implement sessionless authentication?Apr 28, 2025 am 12:24 AM

Implementing session-free authentication can be achieved by using JSONWebTokens (JWT), a token-based authentication system where all necessary information is stored in the token without server-side session storage. 1) Use JWT to generate and verify tokens, 2) Ensure that HTTPS is used to prevent tokens from being intercepted, 3) Securely store tokens on the client side, 4) Verify tokens on the server side to prevent tampering, 5) Implement token revocation mechanisms, such as using short-term access tokens and long-term refresh tokens.

What are some common security risks associated with PHP sessions?What are some common security risks associated with PHP sessions?Apr 28, 2025 am 12:24 AM

The security risks of PHP sessions mainly include session hijacking, session fixation, session prediction and session poisoning. 1. Session hijacking can be prevented by using HTTPS and protecting cookies. 2. Session fixation can be avoided by regenerating the session ID before the user logs in. 3. Session prediction needs to ensure the randomness and unpredictability of session IDs. 4. Session poisoning can be prevented by verifying and filtering session data.

How do you destroy a PHP session?How do you destroy a PHP session?Apr 28, 2025 am 12:16 AM

To destroy a PHP session, you need to start the session first, then clear the data and destroy the session file. 1. Use session_start() to start the session. 2. Use session_unset() to clear the session data. 3. Finally, use session_destroy() to destroy the session file to ensure data security and resource release.

How can you change the default session save path in PHP?How can you change the default session save path in PHP?Apr 28, 2025 am 12:12 AM

How to change the default session saving path of PHP? It can be achieved through the following steps: use session_save_path('/var/www/sessions');session_start(); in PHP scripts to set the session saving path. Set session.save_path="/var/www/sessions" in the php.ini file to change the session saving path globally. Use Memcached or Redis to store session data, such as ini_set('session.save_handler','memcached'); ini_set(

How do you modify data stored in a PHP session?How do you modify data stored in a PHP session?Apr 27, 2025 am 12:23 AM

TomodifydatainaPHPsession,startthesessionwithsession_start(),thenuse$_SESSIONtoset,modify,orremovevariables.1)Startthesession.2)Setormodifysessionvariablesusing$_SESSION.3)Removevariableswithunset().4)Clearallvariableswithsession_unset().5)Destroythe

Give an example of storing an array in a PHP session.Give an example of storing an array in a PHP session.Apr 27, 2025 am 12:20 AM

Arrays can be stored in PHP sessions. 1. Start the session and use session_start(). 2. Create an array and store it in $_SESSION. 3. Retrieve the array through $_SESSION. 4. Optimize session data to improve performance.

How does garbage collection work for PHP sessions?How does garbage collection work for PHP sessions?Apr 27, 2025 am 12:19 AM

PHP session garbage collection is triggered through a probability mechanism to clean up expired session data. 1) Set the trigger probability and session life cycle in the configuration file; 2) You can use cron tasks to optimize high-load applications; 3) You need to balance the garbage collection frequency and performance to avoid data loss.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

DVWA

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

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists

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.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor