LAMP平台实现之PHP加速,xcache
admin
2023-07-04 04:43:08
0

1、安装mysql-5.5.33-linux2.6-x86_64

#tar xf mysql-5.5.33-linux2.6-x86_64.tar.gz  –C /usr/local/
# ln -sv mysql-5.5.33-linux2.6-x86_64 mysql
# cd mysql
#mkdir /mydata
# cat INSTALL-BINARY | less
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql --datadir=/mydata
shell> chown -R root .
shell> chown -R mysql  /mydata
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

修改此文件中thread_concurrency的值为你的CPU个数乘以2,比如这里使用如下行:

# thread_concurrency = 2

另外还需要添加如下行指定mysql数据文件的存放位置:

datadir = /mydata

LAMP平台实现之PHP加速,xcache

为mysql提供sysv服务脚本:并添加服务,还需要添加环境变量

# cd /usr/local/mysql
# cp support-files/mysql.server  /etc/rc.d/init.d/mysqld
# chmod +x /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# vim /etc/profile.d/mysql.sh
# export PATH=/usr/local/mysql/bin:$PATH
# .  /etc/profile.d/mysql.sh
# echo $PATH

LAMP平台实现之PHP加速,xcache

输出mysql的头文件至系统头文件路径/usr/include,并且输出库文件

# ln -sv /usr/local/mysql/include  /usr/include/mysql

# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf

# ldconfig

LAMP平台实现之PHP加速,xcache

2、编译安装php-5.4.26


说明:

1、这里为了支持apache的worker或event这两个MPM,编译时使用了--enable-maintainer-zts选项。

2、如果使用PHP5.3以上版本,为了链接MySQL数据库,可以指定mysqlnd,这样在本机就不需要先安装MySQL或MySQL开发包了。mysqlnd从php 5.3开始可用,可以编译时绑定到它(而不用和具体的MySQL客户端库绑定形成依赖),但从PHP 5.4开始它就是默认设置了。

# ./configure --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd

# yum -y groupinstall "Desktop Platform Development"
# yum -y install bzip2-devel libmcrypt-devel
# tar xf php-5.4.26.tar.bz2
# cd php-5.4.26
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts
# make
# make intall
# cp php.ini-production /etc/php.ini
# vim /etc/httpd/httpd.conf
# AddType application/x-httpd-php  .php
# AddType application/x-httpd-php-source  .phps
# DirectoryIndex  index.php  index.html

LAMP平台实现之PHP加速,xcache

如上图所示:为php提供配置文件:

# cp php.ini-production /etc/php.ini

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache


LAMP平台实现之PHP加速,xcache

LAMP平台实现之PHP加速,xcache


3、安装xcache,为php加速

安装

# tar xf xcache-3.0.1.tar.gz
# cd xcache-3.0.1
# /usr/local/php/bin/phpize
# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
# make && make install

安装结束时,会出现类似如下行:

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20100525/

2、编辑php.ini,整合php和xcache:

首先将xcache提供的样例配置导入php.ini

# mkdir /etc/php.d
# cp xcache.ini /etc/php.d

接下来编辑/etc/php.d/xcache.ini,找到zend_extension开头的行,修改为如下行:

zend_extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so

注意:如果php.ini文件中有多条zend_extension指令行,要确保此新增的行排在第一位。

LAMP平台实现之PHP加速,xcache


相关内容

热门资讯

洋保电子取得用于低温环境的电气... 国家知识产权局信息显示,洋保电子(太仓)有限公司取得一项名为“一种用于低温环境的电气柜”的专利,授权...
中日韩飞手争霸宁波!2026无... 潮新闻客户端 记者 陈冲 通讯员 朱凝 5月31日,2026小遛·无人机竞速世界杯(中国·宁波鄞州站...
谁在对台湾“温水煮青蛙”? 近一段时间以来,两岸的舆论场都非常热闹,但话题却不尽相同。先看看岛内,马英九基金会的“家变”愈演愈烈...
上海磁骋取得超级电容主动均衡电... 国家知识产权局信息显示,上海磁骋交通科技有限公司取得一项名为“一种超级电容主动均衡电路”的专利,授权...
超市运送猪肉时,一只狗跑来啃食... 5月31日,湖北孝昌的网友发布视频称,一家超市在运送猪肉时,肉从车上搬下来后,一只黑色的狗跑来啃食猪...
日本要搞两个首都? 日本媒体日前报道,日本维新会正在推进将大阪设为“副首都”的构想,定于6月中旬组建一个专门小组。对此,...
稳舵扬帆正当时——5月全国各地... 原标题:稳中求进每月看|稳舵扬帆正当时——5月全国各地经济社会发展观察从多地以法治之力护航民营经济高...
燃气灶打火一会就灭是什么原因呢 原因是1、燃气灶过压保护,可以通过增加减压阀来解决这个问题。2、可能是因为燃气灶电池没有电了,可以将...
燃气开的燃气灶打不了火什么原因 可能是燃气灶电池电量不足。可能是燃气通路不畅通,如果火花声音清脆有力,但是点不着火。可能是燃气灶老化...
好太太燃气灶有电有气打不 这种情况原因有很多种,1、可能的原因就是我们的燃气灶进入了过压保护,我们家中使用的很多燃气灶都有过压...