在ubuntu下,進行php7源碼安裝


        作為一名php的攻城師,如果沒有玩php源碼安裝是說不過去的。我們知道php之所以這么流行,跟它的開源文化和lamp配套有很大關系。由於PHP7廢棄了很多功能,所以一些依賴這些功能的程序可能無法運行,嘗鮮前請三思。比如很多國產軟件都在依賴的mysql相關函數,如果自己開發php應用請用mysqli代替。不過WordPress是沒有問題的,盡情使用吧。

       下面進入正題,第一步,當然是下載源碼和解壓        

$ cd ~
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
$ tar -zxvf php-7.0.2.tar.gz
cd php-7.0.2

 第二步,是編譯配置,如果你之前有安裝其它版本的php,請先刪除,再安裝php7;

./configure --prefix=/opt/php-7.0.5 --with-config-file-path=/opt/php-7.0.5/etc --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-mysql-sock --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-libxml-dir=/usr --disable-rpath --enable-bcmath --enable-shmop --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --enable-gd-native-ttf --enable-sockets --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts --disable-debug --enable-shared --enable-opcache --enable-pdo --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-xml --with-xmlrpc --with-libxml-dir --enable-pcntl --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-zlib --enable-zip --with-readline --without-sqlite3 --without-pdo-sqlite --with-libdir=/lib/x86_64-linux-gnu --with-jpeg-dir=/usr/lib --with-apxs2=/usr/bin/apxs --enable-cgi

其實這一步,會遇到很多問題,系統很拋出一些錯誤出來,一般都是由於系統缺少必要的依賴庫。我們可以求助度娘進行解決,就不詳述了。

第三步,編譯和安裝

$ make && make test
$ make && sudo make install

 


免責聲明!

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



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