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


相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...