ubuntu 14.04编译安装php5.2.17过程,储存以备参考

由于自己的一个PHP企业管理软件使用了ZEND,ubuntu的apt软件包都是php5.3以上的版本,没有办法,就自己编译了php5.2.17,将整个过程记录下来,以备以后查找
下载源码
cd ~
wget http://musemu.php.net/php5/php-5.2.17.tar.gz

安装补丁
mkdir opt
cd opt
mv *.gz opt
tar zxvf php-5.2.17
cd php-5.2.17

wget -c http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
gzip -d php-5.2.17-fpm-0.5.14.diff.gz
patch -p1 < php-5.2.17-fpm-0.5.14.diff

wget http://soft.vpser.net/web/php/bug/php-5.2.17-max-input-vars.patch
patch -p1 < php-5.2.17-max-input-vars.patch

wget -c -t 3 -O ./debian_patches_disable_SSLv2_for_openssl_1_0_0.patch https://bugs.php.net/patch-display.php\?bug_id\=54736\&patch\=debian_patches_disable_SSLv2_for_openssl_1_0_0.patch\&revision=1305414559\&download\=1
patch -p1 < ./debian_patches_disable_SSLv2_for_openssl_1_0_0.patch

curl -o php-5.2.17.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
patch -p0 -b <php-5.2.17.patch

ubuntu 14.04安装编译所需的库
sudo apt-get install gcc
sudo apt-get install make
sudo apt-get install patch

sudo apt-get install libxml2-dev
sudo apt-get install libssl-dev
sudo apt-get install libmcrypt-de
sudo apt-get install libjpeg-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libpng12-dev
sudo apt-get install libxpm-dev
sudo apt-get install libfreetype6-dev
ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype
sudo apt-get install libmhash-dev
sudo apt-get install libmysqlclient-dev

编译配置php5.2.17

sudo ./configure --prefix=/usr/local/php --enable-fastcgi --enable-zip --enable-fpm --enable-gd-native-ttf --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-bz2 --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-png-dir --with-mcrypt --with-mhash --enable-mbstring --with-kerberos --with-gettext --enable-bcmath --with-mysql --with-mysqli --with-sqlite --enable-pdo --with-pdo-mysql --with-openssl --enable-ftp --with-pear --with-zlib --enable-inline-optimization --enable-calendar --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --disable-debug
--with-libdir=/lib/x86_64-linux-gnu

编译:
make
make test
make install
make clean

以下是几个错误信息,没有记全,随便记了几个:

错误 make ext/dom/node.lo error 1

$ curl -o php-5.2.17.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
$ tar jxf php-5.2.17.tar.bz2
$ cd php-5.2.17
$ patch -p0 -b <../php-5.2.17.patch
patching file ext/dom/node.c
patching file
ext/dom/documenttype.c
patching file ext/simplexml/simplexml.c

ext/openssl/xp_ssl.c:357: undefined reference to `SSLv2_server_method’
ext/openssl/xp_ssl.c:337: undefined reference to `SSLv2_client_method’
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] 错误 1

wget -c -t 3 -O ./debian_patches_disable_SSLv2_for_openssl_1_0_0.patch https://bugs.php.net/patch-display.php\?bug_id\=54736\&patch\=debian_patches_disable_SSLv2_for_openssl_1_0_0.patch\&revision=1305414559\&download\=1
patch -p1 < ./debian_patches_disable_SSLv2_for_openssl_1_0_0.patch

参考网址:
http://blog.csdn.net/white__cat/article/details/28909621
http://www.cnblogs.com/lost-1987/articles/4029344.html
https://shusite.com/archives/3024

启动php-fpm的时候出现
Starting php_fpm Dec 29 15:27:32.502790 [ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool ‘default’
解决办法;
只需要修改php-fpm.conf
Unix user of processes

Unix group of processes

将<!– –>去掉即可。至于user/group根据实际情况修改(www)。
重新启动 /usr/local/webserver/php-fpm/sbin/php-fpm start 成功了!

shuxin

发表评论

电子邮件地址不会被公开。 必填项已用*标注