php5.6.22
关闭防火墙命令:
service iptables stop[stop|start|restart]
查看环境变量:
echo $PATH
解决依赖关系
到http://ftp.riken.jp/Linux/fedora/epel/下载epel-release-latest-6.noarch.rpm
rpm -ivh epel-release-latest-6.noarch.rpm
yum groups mark install "Development Tools" yum groups mark convert "Development Tools" yum groupinstall "Development Tools" yum -y install libmcrypt libmcrypt-devel mhash mhash-devel mcrypt yum -y install libevent libevent-devel yum -y install gd gd-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel yum -y install libxml2 libxml2-devel yum install -y bzip2 bzip2-devel yum install -y libcurl libcurl-devel yum install openssl openssl-devel
解压 编译 安装
tar -zxvf php-5.6.22.tar.gz cd php-5.6.22
./configure --prefix=/usr/local/php
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--with-openssl
--enable-fpm
--enable-gd-native-ttf
--enable-soap
--enable-sockets
--enable-sysvshm
--enable-mbstring
--with-freetype-dir
--with-jpeg-dir
--with-png-dir
--with-zlib-dir
--with-gd
--with-libxml-dir=/usr/
--enable-xml
--with-mhash
--with-mcrypt
--with-bz2
--with-curl
--with-fpm-user=php
--with-fpm-group=php
--with-config-file-path=/etc
--with-config-file-scan-dir=/etc/php.dmake make install
默认php.ini目录为/usr/local/php/lib
创建目录 mkdir -p /usr/local/php/lib/php
php启动脚本
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm
配置文件
cp php.ini-production /etc/php.ini cd /usr/local/php cp etc/php-fpm.conf.default etc/php-fpm.conf vi etc/php-fpm.conf 修改 user = nginx group = nginx
zend-loader-php 扩展安装
tar -zxvf zend-loader-php5.6-linux-x86_64.tar.gz cd zend-loader-php5.6-linux-x86_64
cp ZendGuardLoader.so /usr/local/php/lib/php/
配置
下载编辑php.ini 最后加上:
[Zend]zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so
swoole 拓展安装
wget https://github.com/swoole/swoole-src/archive/swoole-1.7.6-stable.tar.gz 1 tar zxvf swoole-1.7.6-stable.tar.gz cd swoole-1.7.6-stable phpize ./configure make && make install
phpize 命令如果提示phpize找不到,直接去php的安装位置下的bin文件夹找 运行phpize也可以记得写全路径;
./configure 如果报错找不到php-config:记得带上路劲./configure --with-php-config=/usr/local/php/bin/php-config
PHP安装zip拓展
wget http://pecl.php.net/get/zip tar -zvxf zip cd zip-1.14.0
phpize ./configure make make install
如果执行./configure --with-php-config=/usr/local/php/bin/php-config 发现报错缺少libzip,则需要先安装libzip;
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make
make install
安装libzip ./configure 的时候如果找不到'zipconf.h',或者是有文件的变量没有定义,原因是没有找到头文件;
find /usr/local -iname 'zipconf.h'
找到这个文件之后;
ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include
之后再进行编译;
最后修改php.ini加入编译之后的拓展,重启php-fpm;
配置自启动
chkconfig --add php-fpm chkconfig php-fpm on