PHP-5.6部署安装

部署环境:

  • Centos7.2.1511
  • Php5.6

部署安装:

  • 安装依赖包:
id www||useradd www  -M -s /sbin/nologin
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel \
libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype \
freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel \
libxslt libxslt-devel  gcc-c++ libicu-devel -y
  • 下载PHP源码包并编译安装
wget http://down.niknk.com/PHP/php-5.6.37.tar.gz
tar xf php-5.6.37.tar.gz
cd php-5.6.37/
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-fpm-user=www    \
--with-fpm-group=www   \
--with-mysql=mysqlnd   \
--with-mysqli=mysqlnd  \
--with-pdo-mysql=mysqlnd  \
--with-iconv-dir  \
--with-freetype-dir  \
--with-jpeg-dir  \
--with-png-dir  \
--with-zlib  \
--with-curl  \
--with-mcrypt  \
--with-gd  \
--with-openssl  \
--with-mhash    \
--with-xmlrpc   \
--with-gettext  \
--with-libxml-dir=/usr \
--without-pear  \
--disable-rpath \
--disable-fileinfo \
--enable-mysqlnd   \
--enable-fpm   \
--enable-ftp   \
--enable-xml   \
--with-xsl     \
--enable-intl  \
--enable-zip   \
--enable-soap  \
--enable-bcmath   \
--enable-shmop    \
--enable-sysvsem  \
--enable-inline-optimization  \
--enable-gd-native-ttf  \
--enable-pcntl    \
--enable-sockets  \
--enable-maintainer-zts  \
--enable-mbregex   \
--enable-mbstring  \
--enable-opcache
make && make install
  • 将PHP添加到环境变量
cat > /etc/profile.d/PHP-BIN.sh <<EOF
export PHP_BIN=/usr/local/php/bin
export PATH=\${PATH}:\${PHP_BIN}
EOF
source /etc/profile.d/PHP-BIN.sh
  • 拷贝相关配置文件并启动
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
/etc/init.d/php-fpm start
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注