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

猜你喜欢

转载自blog.csdn.net/ZHUBOYAN123/article/details/47108251