dtftao7249656 2016-08-06 07:19
浏览 78
已采纳

无法安装旧版本的php

I need to install an old version of php, because I have a website which is based on that version and won't run with the current one. I know that this should not be done, but it will only be online while updating everything.

I followed this guide: http://mstd.eu/index.php/2016/07/04/install-old-versions-of-software-on-debian-like-php-5-3/ but when calling phpinfo(), I get: Version 5.6.24-0+deb8u1.

I also tried to install php via tarball, which worked, but I won't get it to run with apache...

What can I do to achieve that?

Edit: dpkg --list shows me, that I have the following installed:

php5          5.3.10-2
php5-cli      5.6.24+dfsg-
php5-common   5.6.25+dfsg-
php5-json     1.3.6-1
php5-readline 5.6.24+dfsg-
  • 写回答

1条回答 默认 最新

  • duan0708676887 2016-08-06 08:17
    关注

    TL;DR

    So here's the issue in the How To you read: it does not outline every package in the specific version it is actually required. So it (probably) installed the correct PHP version, but not the correct cli version and for sure not the correct apache mod.

    I managed to build an apt-get command that installs the correct apache and php version. So with that you have a basic installation (with not that many extensions and stuff) you can go ahead with:

    apt-get install php5=5.3.10-2 php5-cli=5.3.10-2 php5-common=5.3.10-2 \
    libapache2-mod-php5=5.3.10-2 apache2=2.2.22-1 apache2.2-common=2.2.22-1 \
    apache2-mpm-prefork=2.2.22-1 ssl-cert apache2.2-bin=2.2.22-1
    

    How i got there

    I want to outline here how i got there for documenation purpose:

    I basically startet with the php5 and php5-cli package and the run into a lot of apt-get issues that looks like that:

    The following packages have unmet dependencies:
     apache2-bin : Conflicts: apache2.2-common but 2.2.22-1 is to be installed
     apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1) but 2.4.7-1ubuntu4.13 is to be installed
     libapache2-mod-php5 : Depends: apache2-mpm-prefork (> 2.0.52) but it is not going to be installed or
                                    apache2-mpm-itk but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

    The easiest way is then to run a madison to list the available versions and choose the right one (which in your case will probably always be the oldest one):

    apt-cache madison apache2-mpm-prefork
    apache2-mpm-prefork | 2.4.10-1ubuntu1.1~ubuntu14.04.1 | http://us.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
    apache2-mpm-prefork | 2.4.7-1ubuntu4.13 | http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
    apache2-mpm-prefork | 2.4.7-1ubuntu4.13 | http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
    apache2-mpm-prefork | 2.4.7-1ubuntu4 | http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
    apache2-mpm-prefork |   2.2.22-1 | http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable/main amd64 Packages
       apache2 | 2.4.7-1ubuntu4 | http://us.archive.ubuntu.com/ubuntu/ trusty/main Sources
       apache2 | 2.4.7-1ubuntu4.13 | http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main Sources
       apache2 | 2.4.10-1ubuntu1.1~ubuntu14.04.1 | http://us.archive.ubuntu.com/ubuntu/ trusty-backports/main Sources
       apache2 | 2.4.7-1ubuntu4.13 | http://security.ubuntu.com/ubuntu/ trusty-security/main Sources
       apache2 |   2.2.22-1 | http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable/main Sources
    

    And just to mention it, this is Apache 2.2 going to be installed. I have no idea how supported that still is, but I am sure that PHP 5.3 is way to old. You might expose yourself to quite a huge security issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码