ubuntu14.04编译安装PHP7
下载安装包 wget http://mirrors.sohu.com/php/php-7.0.16.tar.gz解压 tar zxvf php-7.0.16.tar.gz进行配置之前安装必要的包,否则会出现下面的一些问题
sudo apt-get install libxml2-dev openssl libssl-dev curl libcurl4-gnutls-dev libjpeg-dev libpng12-dev libfreetype6 libfreetype6-dev libmcrypt4 libmcrypt-dev配置
cd php-7.0.16sudo ./configure --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --enable-fpm --with-fpm-user=www-data \ --with-pdo-mysql=mysqlnd \ --with-libxml-dir --with-gd \ --with-jpeg-dir --with-png-dir \ --with-freetype-dir --with-iconv-dir --with-zlib-dir \ --with-mcrypt --enable-soap --enable-gd-native-ttf \ --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 \ --with-pear --with-curl --with-openssl编译
make安装
make install修改配置文件 cp php.ini-production /usr/local/php/etc/php.ini使用php-fpm方式运行的设置 配置php-fpm cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf cp php-fpm.d/www.conf.default php-fpm.d/www.conf 启动php-fpm sudo /usr/local/php/sbin/php-fpm
配置过程中可能遇到的错误:
configure: error: xml2-config not found. Please check your libxml2 installation. 解决: sudo apt-get install libxml2-devconfigure: error: Cannot find OpenSSL’s libraries 解决: sudo apt-get install openssl libssl-dev 如果已经安装,libssl.so文件通常会在只会在/usr/lib/x86_64-linux-gnu/libssl.so,而系统只会去/usr/lib下寻找libssl.so文件,所以: ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/libconfigure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/ 解决: sudo apt-get install curl libcurl4-gnutls-devconfigure: error: jpeglib.h not found. 解决: sudo apt-get install libjpeg-dev configure: error: png.h not found. 解决: sudo apt-get install libpng12-devconfigure: error: freetype-config not found. 解决: sudo apt-get install libfreetype6 libfreetype6-devconfigure: error: mcrypt.h not found. Please reinstall libmcrypt. 解决: sudo apt-get install libmcrypt4 libmcrypt-dev
注:配置过程中出现的问题基本是缺少包,或者是找不到包文件
转载请注明原文地址: https://ju.6miu.com/read-22042.html