
安装编译依赖
sudo apt-get -y install build-essential git autoconf
sudo apt-get build-dep php5
sudo apt-get -y install libt1-dev libgmp-dev bison
sudo apt-get -y install mysql-server mysql-client libmysqlclient-dev
apt-get install libfcgi-dev libfcgi0ldbl ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
编译选项
./configure --prefix=/usr --with-config-file-path=/etc --enable-mbstring --enable-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-curl --with-mcrypt --with-iconv --with-gmp --with-pspell --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --with-t1lib=/usr --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --with-pdo-mysql=/usr --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr --with-recode=/usr --with-mysqli=/usr/bin/mysql_config --with-apxs2=/usr/bin/apxs2
具体的configure参数信息可以通过
./configure --help
查看到
开始编译安装
make && make install
提示缺少apxs:
在Ubuntu中,采用
sudo apt-get install apache2
安装apache服务后,是不会带Apxs,需要安装 apache2-dev。其命令是:
sudo apt-get install apache2-dev
安装完后查看安装的路径:find / -name 'apxs2'
configure: error: Cannot find OpenSSL's <evp.h>
sudo apt-get install libcurl4-openssl-dev pkg-config
然后继续使用--with-openssl 不用带路径
configure: error: freetype-config not found.
解决办法如下:
apt-get -y install libfreetype6-dev
configure: error: Cannot find ldap libraries in /usr/lib
把 /usr/lib/x86..../目录下的libldap*文件拷贝到 /usr/lib
cp /usr/lib/x86_64-linux-gnu/libldap* /usr/lib
configure: error: Can not find recode.h anywhere under yes /usr/local /usr /opt
sudo apt-get install librecode-dev
Linux下编译软件如果遇到can not find 问题大多可以通过
sudo apt list '*缺少的文件名*‘
来查找的然后安装既可以,最后PHP7就安装好了。
可以参考:http://jcutrer.com/howto/linux/how-to-compile-php7-on-ubuntu-14-04