安装编译PHP7.X

安装此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. 下载php7.3.2,去官网php或者直接在迅雷里下载(http://cn2.php.net/distributions/php-7.3.2.tar.gz)

  3. 解压php压缩包

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

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

    [root@minion-1 ~]# cd php-7.3.2/ && ./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-apxs2=/usr/local/apache2.4/bin/apxs --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-native-ttf --enable-mbstring --enable-sockets --enable-exif

  5. make编译

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

  6. 复制模板文件

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

  7. 查看php模块是否加载

    [root@minion-1 php-7.3.2]# httpd -M
    ..............................
    autoindex_module (shared)
    dir_module (shared)
    alias_module (shared)
    php7_module (shared)

    1. 如果有php5和php7共存,注销一个,不然会有冲突

      [root@minion-1 php-7.3.2]# vi /usr/local/apache2.4/conf/httpd.conf
      ..................................
      #LoadModule rewrite_module modules/mod_rewrite.so
      #LoadModule php5_module modules/libphp5.so
      LoadModule php7_module modules/libphp7.so

上一篇:PHP7实战开发简单CMS内容管理系统(10)删除单个栏目数据


下一篇:安装PHP7 redis扩展: