Ubuntu編譯PHP7問題


安裝編譯依賴

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中,采用

1  sudo apt-get install apache2

安裝apache服務后,是不會帶Apxs,需要安裝 apache2-dev。其命令是:

1 sudo apt-get install apache2-dev


安裝完后查看安裝的路徑:find / -name 'apxs2'

 

configure: error: Cannot find OpenSSL's <evp.h>

1 sudo apt-get install libcurl4-openssl-dev pkg-config

然后繼續使用--with-openssl 不用帶路徑

 

configure: error: freetype-config not found.

 

解決辦法如下:

1 apt-get -y install libfreetype6-dev

configure: error: Cannot find ldap libraries in /usr/lib

把 /usr/lib/x86..../目錄下的libldap*文件拷貝到 /usr/lib

 

1 cp /usr/lib/x86_64-linux-gnu/libldap* /usr/lib

 

configure: error: Can not find recode.h anywhere under yes /usr/local /usr /opt

 

 

1 sudo apt-get install librecode-dev

Linux下編譯軟件如果遇到can not find 問題大多可以通過

1 sudo apt list '*缺少的文件名*‘

來查找的然后安裝既可以,最后PHP7就安裝好了。

 

 

 

可以參考:http://jcutrer.com/howto/linux/how-to-compile-php7-on-ubuntu-14-04


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM