Ubuntu 16.04 源码编译安装PHP7
在Ubuntu 16.04下源码编译安装PHP7 过程记录。
一、下载PHP7的最新版源码
php7.0.9 下载地址 http://php.net/get/php-7.0.9.tar.gz/from/a/mirror
二、解压
tar -zxf /tmp/php-7.0.9.tar.gz
三、安装相关依赖库
sudo apt-get update sudo apt-get install libxml2-dev #安装gcc sudo apt-get install build-essential sudo apt-get install openssl sudo apt-get install libssl-dev sudo apt-get install make sudo apt-get install curl sudo apt-get install libcurl4-gnutls-dev sudo apt-get install libjpeg-dev sudo apt-get install libpng-dev sudo apt-get install libmcrypt-dev sudo apt-get install libreadline6 libreadline6-dev
四、编译:(编译参数2个中选择一个,第一段大部分机器即可编译,第二段参数推荐64位x86系统编译)
cd /tmp/php-7.0.9 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/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 --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
cd /tmp/php-7.0.9 ./configure --prefix=/usr/local/php --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --with-mysql --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --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 --enable-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear --with-libdir=/lib/x86_64-linux-gnu --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --enable-xml
五、执行make 和 sudo make install 安装
make && sudo make install
六、配置php-fpm
cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf cd /usr/local/php/etc/php-fpm.d cp www.conf.default www.conf user = www group = www 如果www用户不存在,那么先添加www用户 groupadd www useradd -g www www
七、验证PHP
/usr/local/php/bin/php -v
八、启动php-fpm
PHP 的详细介绍:请点这里
PHP 的下载地址:请点这里
相关推荐
liyansring 2020-08-15
liym 2020-07-20
katanaFlower 2020-07-05
JM 2020-06-21
zhangpan 2020-06-11
greent00 2020-06-10
wintelx 2020-02-18
csdmeb 2020-06-08
zwt00 2020-05-29
Dawnworld 2020-04-10
dongfangxiaozi 2020-07-19
咻咻ing 2020-06-16
VFCSDN 2020-06-07
IsanaYashiro 2020-06-06
GluttonousZX 2020-06-06
yss0 2020-06-02
lilygg 2020-05-29