系統: Centos7php
httpd版本: 2.4 使用event工做模式html
安裝方法:mysql
使用yum安裝httpd和mariadbsql
編譯安裝php,啓用多線程支持vim
1、安裝httpd和mariadb:多線程
yum install -y httpd httpd-devel php-mysql mariadb-serversocket
systemctl start mariadb //啓動mariadbide
systemctl start httpd //啓動httpd測試
2、安裝PHP:spa
1.準備源碼包
2. 安裝所需環境
yumgroupinstall -y "Development tools" "Server PlatformDevelopment"
yum install -y bzip2-devel libmcrypt-devel libxml2-developenssl-devel
3. 安裝PHP
tar -xjvf php-5.4.26.tar.bz2
cd php-5.4.26
./configure--prefix=/usr/local/php --with-mysql --with-openssl --with-mysqli--enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir--with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2 --with-mcrypt --with-config-file-path=/etc/php--with-config-file-scan-dir=/etc/php/php.d --with-bz2 --enable-maintainer-zts
//使php支持多線程
make -j 4 && makeinstall //使用4線程編譯,能提升速度
mkdir /etc/php //用於存放php配置文件,要和編譯時指定的一致
cp php.ini-production/etc/php/php.ini
3、配置httpd:
vim /etc/httpd/conf.modules.d/00-mpm.conf
vim /etc/httpd/conf/httpd.conf
httpd -t //檢查配置
systemctl reload httpd //重載配置
測試
vim /var/www/html/index.php //準備測試文件
vim /var/www/html/db.php
4、整合xcache:
1.準備源碼包
2. 安裝xcache
tar -xjvf xcache-3.0.3.tar.bz2
cd xcache-3.0.3
/usr/local/php/bin/phpize //生成configure
./configure --enable-xcache--with-php-config=/usr/local/php/bin/php-config
make && make install
3.整合xcache
mkdir /etc/php/php.d //用於存放配置文件,要和編譯php時指定的路徑一致
cp xcache-3.0.3/xcache.ini/etc/php/php.d //複製配置文件
vim /etc/php/php.d/xcache.ini
systemctl reload httpd //重載配置文件