Home Backend Development PHP Tutorial 微凉大大,教你一步一步在linux中正确的安装Xcache加速php。

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

Jun 23, 2016 pm 01:54 PM
php step accelerate Install correct

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


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


#第一步,下载Xcache

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


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


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

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


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


#第三步,非常重要,基本出错都在这里。
#首先,安装前要执行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
Copy after login


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


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




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

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


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


#如果你很笨,还是建议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
Copy after login




上面都是需要注意的地方。
以下给出我配置好的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 = ""
Copy after login






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




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


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


例如 zend optimizer,这个东西就会冲突。解决方法就是把 zend_extension 改成 Xcache定义的缓存文件中。
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

See all articles