search
Homephp教程php手册PHP5 XCache安装指南

PHP5 XCache安装指南

Jun 06, 2016 pm 07:53 PM
php5xcacheInstallfastguide

XCache是一款快速、稳定的php代码级缓存器,可以为高负载环境下的服务器提供一个有效的缓冲层。与它类的缓冲器有eAccelerator、APC。 本文介绍了,如果为php安装XCache^_^。 测试环境搭建 我在centos5.5下使用apache2php5搭建了一个简单的测试环境,网站根目

XCache是一款快速、稳定的php代码级缓存器,可以为高负载环境下的服务器提供一个有效的缓冲层。与它类似的缓冲器有eAccelerator、APC。

本文介绍了,如果为php安装XCache^_^。

测试环境搭建

我在centos5.5下使用apache2+php5搭建了一个简单的测试环境,网站根目录在/var/www/html 下。

查看php5当前配置

在安装xcache之前,我们应该先检查一下自己的php配置,在/var/www/html 目录下新建info.php,并写入如下代码:

?

1

touch /var/www/html/info.php

?

1

2

3

<?php

phpinfo();

?>

在浏览器中查看phpinfo信息,http://localhost/info.php

PHP5 XCache安装指南

当然现在你还看不到xcache的安装信息

PHP5 XCache安装指南

如果你在配置上图的配置中看到其他的缓存器,如eAccelerator或APC,需要先删除它们:

?

1

2

3

4

5

6

#删除eaccelerator

yum remove php-eaccelerator

#删除APC

yum remove php-pecl-apc

重启httpd服务器

/etc/init.d/httpd restart

开始安装XCache
由于XCache没有现成的rpm安装包,我们需要手动编译这个模块。

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

yum install php-devel

yum groupinstall 'Development Tools'

yum groupinstall 'Development Libraries'

#下载最新的XCache,并解压

cd /tmp

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

tar xvfz xcache-1.3.0.tar.gz

cd xcache-1.3.0

#使用phpize工具编译Xcache

phpize

./configure --enable-xcache

make

make install

#把xcache的配置文件拷贝到php配置目录中

cp xcache.ini /etc/php.d

配置XCache

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

vi /etc/php.d/xcache.ini

[xcache-common]

;; install as zend extension (recommended), normally "$extension_dir/xcache.so"

;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so

; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so

;; For windows users, replace xcache.so with php_xcache.dll

;zend_extension_ts = c:/php/extensions/php_xcache.dll

;; or install as extension, make sure your extension_dir setting is correct

extension = xcache.so

;; or win32:

; extension = php_xcache.dll

[...]

xcache.size  =                60M

[...]

重启Apache服务器

?

1

/etc/init.d/httpd restart

再次查看phpinfo信息,如果看见下面两张图,恭喜配置成功

PHP5 XCache安装指南

PHP5 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

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

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

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

Atom editor mac version download

Atom editor mac version download

The most popular open source editor