官网 php.net,下载相应的版本
常用的配置
./configure --prefix=/usr/local/php
--with-curl
--with-freetype-dir
--with-gd
--with-gettext
--with-iconv-dir
--with-kerberos
--with-libdir=lib64
--with-libxml-dir
--with-mysqli
--with-openssl
--with-pcre-regex
--with-pdo-mysql
--with-pdo-sqlite
--with-pear
--with-png-dir
--with-jpeg-dir
--with-xmlrpc
--with-xsl
--with-zlib
--enable-fpm
--enable-bcmath
--enable-libxml
--enable-inline-optimization
--enable-mbregex
--enable-mbstring
--enable-opcache
--enable-pcntl
--enable-shmop
--enable-soap
--enable-sockets
--enable-sysvsem
--enable-xml
--enable-zip
--without-pear
--disable-phar
--enable-sysvmsg
--enable-maintainer-zts
make && make install
cp php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
估计需要的依赖
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre-devel openssl openssl-devel
yum -y install curl-devel
yum -y install libxslt-devel
解决PHP编译cURL的reinstall the libcurl问题
在安装其他的扩展的时候会出现 Cannot find autoconf. Please check your autoconf installatio
需要安装 yum install autoconf
RetHat CentOS or Fedora 使用下面安装命令
yum install curl curl-devel
Debian or Ubuntu使用下面的安装命令
apt-get install curl
apt-get install libcurl4-gnutls-dev
再安装phar
wget http://pear.php.net/go-pear.phar
/usr/local/php/bin/php go-pear.phar
详细请看原创:http://blog.csdn.net/21aspnet/article/details/47708763
关于在Ubuntu中找不到
1,configure: error: Cannot find OpenSSL's <evp.h>
安装 openssl 和libcurl4-openssl-dev 还要 libssl-dev
2,configure: error: jpeglib.h not found.
sudo apt-get install libjpeg-dev
3,configure: error: png.h not found.
sudo apt-get install libpng12-dev
http://blog.csdn.net/white__cat/article/details/28907535 //ubuntu源码编译安装php常见错误解决办法
一个新购的阿里云Ubuntu16.04 编译安装php
sudo apt-get install
openssl libcurl4-openssl-dev libssl-dev libpng-dev libfreetype6-dev libxslt1-dev
configure: WARNING: unrecognized options: --enable-gd-native-ttf
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
yum -y install postgresql-devel