centos7 编译安装 php

环境准备

# yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel jemalloc jemalloc-devel

# cd /data/server/

# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

# tar zvxf php-5.6.30.tar.gz

# cd php-5.6.30

# groupadd www-data

# useradd -g www-data -s /sbin/nologin www-data

编译安装

./configure --prefix=/data/server/php --with-config-file-path=/data/server/php/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline

make  && make install

##重新安装

# make clean

# make clean all

# ./configure

# make && make install

配置服务

#配置文件

# cp /data/server/php-5.6.38/php.ini-development /data/server/php/etc/php.ini

#php-fpm 服务

# cp /data/server/php/etc/php-fpm.conf.default /data/server/php/etc/php-fpm.conf

# cp /data/server/php-5.6.38/sapi/fpm/init.d.php-fpm   /etc/init.d/php-fpm

# chmod +x /etc/init.d/php-fpm

# chkconfig --add php-fpm

# chkconfig on php-fpm

# service php-fpm start

环境变量

# vi /etc/profile

PATH=$PATH:/data/server/php/bin

export PATH

# source /etc/profile

猜你喜欢

转载自blog.csdn.net/Dreamweav2004/article/details/83317176