1. 程式人生 > >ubuntu下編譯安裝php5.4

ubuntu下編譯安裝php5.4

1、編譯引數

./configure  --prefix=/usr/local/php5.4  --enable-fpm  --enable-fastcgi --enable-force-CGI-redirect --with-config-file-path=/usr/local/php5.4/etc --with-mcrypt=/usr/local/libmcrypt  --with-zlib  --enable-mbstring   --with-mysql  --with-mysqli  --with-mysql-sock --with-mhash  --enable-soap  --with-gd  --with-jpeg-dir=/usr/local/jpeg  --enable-gd-native-ttf  --enable-pdo  --with-pdo-mysql  --with-gettext  --with-curl  --enable-sockets  --enable-bcmath   --with-bz2  --with-gettext   --enable-zip --with-openssl --enable-sockets

2、可能遇到的錯誤的處理

提示bzip2缺失

sudo apt-get install libbz2-dev
configure: error: Please reinstall the libcurl distribution -
sudo apt-get install libcurl3-dev
configure: error: jpeglib.h not found.
再次編譯,遇到問題:configure: error: jpeglib.h not found. 解決辦法:
(1)去網站 http://www.ijg.org/ 下載原始碼。我用的版本是jpegsrc.v8d.tar.gz,執行命令:sudo tar -zxvf jpegsrc.v8d.tar.gz -C /usr/src
(2)進入/usr/src/jpegsrc.v8d目錄,sudo方式執行命令:sudo ./configure --prefix=/usr/local/jpeg;make;make install;
(3)重新編譯php,增加引數--with-jpeg-dir=/usr/local/jpeg
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
 (1)去網站http://mcrypt.hellug.gr/lib/index.html 的下載原始碼,我下的版本是libmcrypt-2.5.7.tar.gz;執行命令:sudo tar -zxvf libmcrypt-2.5.7.tar.gz -C /usr/src
 (2)進入/usr/src/libmcrypt-2.5.7目錄,sudo方式執行命令:./configure prefix=/usr/local/libmcrypt/;make ;make install 
 (3)重新編譯php,這時增加引數--with-mcrypt=/usr/local/libmcrypt