vagrant中centos编译安装php7.1.9

来源:互联网 发布:js toggle 编辑:程序博客网 时间:2024/05/22 14:19

半成品,稍后整理



一、安装依赖

yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel

二、下载PHP源码包

cd /opt/soft

wget http://php.net/get/php-7.1.9.tar.gz/from/a/mirror

tar zxvf php-7.1.9.tar.gz

cd php-7.1.9

./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-png-dir --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/local/libmcrypt --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd  --with-iconv --with-zlib --enable-inline-optimization --with-gd --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl=/usr/local/curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm  --with-fpm-user=vagrant --with-fpm-group=vagrant --without-gdbm --disable-fileinfo --enable-opcache=no --with-gd


编译过程中如发现缺少什么库了,记得百度找下官网去下载源码编译下,然后在来编译PHP



直接使用编译后未经优化处理的配置
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf


vim /etc/profile

/usr/local/php/bin:/usr/local/php/sbin
source /etc/profile

chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on