在Ubuntu中编译安装PHP7
2022年9月7日
  • 下载php到本地
  • 解压
  • 预编译,记得同时创建 /opt/php 目录

./configure –prefix=/opt/php –with-config-file-path=/opt/php/etc –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-mysqli –with-pdo-mysql –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl-dir=/usr/bin/curl –enable-mbregex –enable-mbstring –enable-ftp –with-gd –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –disable-fileinfo –enable-maintainer-zts

  • 缺少组件
  • 安装缺少组件依赖

apt-get install libbz2-dev libxml2-dev libjpeg-dev libpng-dev libfreetype6-dev libzip-dev libssl-dev

  • 然后重新预编译,重新执行 之前的./configure 那一串
  • 开始编译 make
  • 执行以下命令进行安装 make install
  • 安装完成 查看版本