Step by step to install the Xcache speedup php correctly in linux

  • 2020-05-30 21:44:47
  • OfStack

First of all, strong ridicule, the tutorial on baidu, left copy right copy, 78 mess, lack of east lack of west. Take this slightly cool greatly I offer my painstakingly arranged tutorial. So that you can use Xcache to speed up php smoothly. If you have finished reading it, you can also operate it, but you still fail, please contact weiliang big QQ 496928838. Weiliang also wants to see how you can't install it step by step.

Step 1: download Xcache


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

Step 1 is very simple. If you can't download it, it's a matter of character.

Step 2, unzip the Xcache source.


tar -zvxf xcache-3.1.0.tar.gz 

# 2, also very simple, if you can't handle it it's a character problem.

Next, by the way, go to the installation directory


cd xcache-3.1.0

Step # 3, very important, where most things go wrong.
First, perform the phpize configuration before installation

/php path /bin/phpize

Please make sure php is installed. If php is not installed, please install php first. (well, if you don't have php, you have Xcache.)

Next, configure - > Compile - > Installation, can be 1 step in place, as long as your path is not wrong.


# configuration 
./configure --prefix=/php The path of the /lib/php/extensions \
--with-php-config=/php The path of the /bin/php-config \
--enable-xcache
# compile 
make
# The installation 
make install

When the installation is complete, something like the following will appear to confirm that the installation was successful.
/www/php/extensions/no-debug-non-zts-20060613/

At this point, once the installation is complete, all that remains is the configuration.

Move the xcache administration page to the web directory.


cp ./htdocs /www/web/xcache -r 

#./htdocs, which is in the source directory. Don't tell me you can't find it.
#/www/web/xcache, web directory, name what you like.
If you're stupid, of course. I can't afford to use this command. Then, in the unzipped source directory, directly through a tool like FTP, direct movement is also OK.

Configuration php ini,
Again, in the source directory, find xcache.ini, and then directly after php.ini.
Or append the configuration files xcache.ini to php.ini with the following command


cat xcache.ini >> /php The path of the /etc/php.ini

If you are stupid, it is recommended to operate inside FTP, because you need to change the username and password of the administration later.

Note that the properties in xcache.ini are modified. At this point, after executing the above command, you will edit php.ini.


xcache.admin.user = "admin"
xcache.admin.pass = "21232f297a57a5a743894a0e4a801fc3"

The password is admin, want to change the password or something, with your intelligence you know.
xcache.mmap_path = "/tmp/xcache"
This file is suggested in the tmp directory. Remember to give 777 permissions.


touch /tmp/xcache 
chmod 777 /tmp/xcache 

All of these are things to watch out for.
The following is the xcache.ini I configured, and I removed the comments.
Comments please to http: / / xcache lighttpd. net/wiki/XcacheIni slowly see here...


[xcache-common]
extension = xcache.so
[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "admin"
xcache.admin.pass = "21232f297a57a5a743894a0e4a801fc3"
[xcache]
xcache.shm_scheme =    "mmap"
xcache.size =        128M
xcache.count =         1
xcache.slots =        8K
xcache.ttl  =         0
xcache.gc_interval =      0
xcache.var_size =      4M
xcache.var_count =       1
xcache.var_slots =      8K
xcache.var_ttl  =       0
xcache.var_maxttl  =     0
xcache.var_gc_interval =   300
xcache.var_namespace_mode =  0
xcache.var_namespace =    ""
xcache.readonly_protection = Off
xcache.mmap_path =  "/tmp/xcache"
xcache.coredump_directory =  ""
xcache.coredump_type =     0
xcache.disable_on_crash =  Off
xcache.experimental =    Off
xcache.cacher =        On
xcache.stat  =        On
xcache.optimizer =      Off


[xcache.coverager]
xcache.coverager =      Off
xcache.coverager_autostart = On
xcache.coveragedump_directory = ""

Restart the server, it is as simple as that, if there is no accident installed.


service httpd restart

See if there is an Xcache in phpinfo. It is proved that the installation was successful.

If the configuration is complete, the page will not open. Prove that you have a conflict in php.ini.

For example, zend optimizer, this thing will conflict. The solution is to change zend_extension to Xcache defined cache file.


Related articles: