ubuntu 编译 php5.5,ubuntu15.04编译安装php5.3和5.2

我安装的ubuntu  mate 桌面64位

源里的php版本太高,像ecshop这种的程序跑起来老报错,调起来费劲,所以装个5.3.

先卸载php5.6:

sudo apt-get --purge remove php5

sudo apt-get autoremove php5

用 dpkg -l | grep php 和dpkg -l | grep php5 检查,如无返回即干净卸载

下面说一下编译安装php5.3,下载地址:http://php.net/releases/

自己找一个版本,我安装的是5.3.29,以下是具体过程:

下载并解压,执行:

./configure --prefix=/usr/local/php --with-mcrypt --with-gettext --with-mysql --with-gd --with-jpeg-dir --with-png-dir --with-curl --with-freetype-dir --enable-gd-native-ttf --enable-mbstring --enable-sockets --with-pdo-mysql --enable-fpm --with-zlib --enable-zip --with-bz2 --enable-bcmath --with-tidy --with-fpm-user=daemon --with-fpm-group=daemon

报错:error: xml2-config not found. Please check your libxml2 installation.

安装: libxml2-dev

报错:configure: error: Please reinstall the BZip2 distribution

安装: libbzip2-dev

报错:configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/

安装:libcurl4-gnutls-dev

报错:configure: error: jpeglib.h not found.

安装:libjpeg-dev

报错:configure: error: freetype.h not found.

解决办法:

安装:libfreetype6-dev

报错:configure: error: freetype.h not found.

但是libfreetype6-dev和libfreetype6已经安装了,需要做个软链接

ln -sf /usr/include/freetype2 /usr/include/freetype2/freetype

报错:configure: error: mcrypt.h not found. Please reinstall libmcrypt.

安装:libmcrypt-dev

报错:configure: error: Cannot find MySQL header files under yes.

Note that the MySQL client library is not bundled anymore!

安装:libmysql++-dev

报错:configure: error: Cannot find libtidy

安装:libtidy-dev

没问题的话画出现:

+--------------------------------------------------------------------+

| License:                                                           |

| This software is subject to the PHP License, available in this     |

| distribution in the file LICENSE.  By continuing this installation |

| process, you are bound by the terms of this license agreement.     |

| If you do not agree with the terms of this license, you must abort |

| the installation process at this point.                            |

+--------------------------------------------------------------------+

Thank you for using PHP.

然后:make

可以先make test测试一下,如果有问题会出现:

You may have found a problem in PHP.

This report can be automatically sent to the PHP QA team at

http://qa.php.net/reports and http://news.php.net/php.qa.reports

This gives us a better understanding of PHP's behavior.

If you don't want to send the report immediately you can choose

option"s" to save it.  You can then email it to qa-reports@lists.php.net later.

Do you want to send this report now? [Yns]:

我的出现了这个问题,不过没什么影响

最后sudo make install

安装后会出现:

Wrote PEAR system config file at: /usr/local/php/etc/pear.conf

You may want to add: /usr/local/php/lib/php to your php.ini include_path

/home/xxx/下载/php-5.3.29/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin

ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar

Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

安装位置是/usr/local/php,所以要改一下/etc/php5/apache2/php.ini,添加include_path ="/usr/local/php/lib/php"

把原来的/usr/bin/php删掉,或者改名:sudo mv /usr/bin/php /usr/bin/php.bak

把编译出来的php5.3做个软链接:sudo ln -s /usr/local/php/bin/php /usr/bin/php

ecshop说好的支持php5.3和5.2,但是安装了5.2还是报错,再下php5.2.10,重新编译,方法类似,多的报错:

configure: error: libjpeg.(a|so) not found.

sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so.8 /usr/lib/libjpeg.so

configure: error: libpng.(a|so) not found.

sudo ln -s /usr/lib/i386-linux-gnu/libpng12.so.0 /usr/lib/libpng.so

configure: error: Cannot find libmysqlclient under /usr.

sudo ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 /usr/lib/libmysqlclient.so

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值