完美安装centos7编译安装php5.6.40(亲测成功!)

安装此php版本前必须先安装另两篇Apche和myql安装环境,因为路径都是按照这两篇为基础的
https://blog.51cto.com/popli3/2357295
https://blog.51cto.com/popli3/2357211


安装PHP

  1. 安装yum环境(aliyun的yum环境)

    [root@minion-1 ~]#yum -y install bzip2-devel libmcrypt-devel libxml2-devel libjpeg-devel libpng-devel freetype-devel

  2. 下载php5.6.40,去官网php或者直接在迅雷里下载(http://hk2.php.net/distributions/php-5.6.40.tar.gz)

  3. 解压php压缩包

    [root@minion-1 ~]#tar xf php-5.6.40.tar.gz

  4. 进入目录,设置编译环境

    [root@minion-1 php-5.6.40]#cd php-5.6.40/ && ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-nativ-ttf --enable-mbstring --enable-sockets --enable-exif

  5. make编译

    [root@minion-1 php-5.6.40]#make && make install

  6. 复制模板文件

    [root@minion-1 php-5.6.40]# cp php.ini-production /usr/local/php/etc/php.ini

转载于:https://blog.51cto.com/popli3/2358079

你可能感兴趣的:(完美安装centos7编译安装php5.6.40(亲测成功!))