大网数据广告活动
服务器运维问答

Run a specivic (older) php version with nginx, php-fpm on debian

· 52CE 我爱测

In order to migrate old php software, I want to run php 5.3.* so I: Removed php via apt-get purge php* Added the corresponding http://snapshot.debian.org/archive/debian/ to the sources Installed apt-get install php5=5.3.10-2 Now …

问题原文

原帖链接 · Finn · CC BY-SA 3.0

In order to migrate old php software, I want to run php 5.3.* so I:

  1. Removed php via apt-get purge php*
  2. Added the corresponding http://snapshot.debian.org/archive/debian/ to the sources
  3. Installed apt-get install php5=5.3.10-2

Now if I do apt-cache policy php5 I get:

php5:
  Installed: 5.3.10-2
  Candidate: 5.6.17+dfsg-0+deb8u1
  Version table:
     5.6.17+dfsg-0+deb8u1 0
        500 http://ftp.debian.org/debian/ jessie/main amd64 Packages
     5.6.14+dfsg-0+deb8u1 0
        500 http://security.debian.org/ jessie/updates/main amd64 Packages
 *** 5.3.10-2 0
        500 http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable/main amd64 Packages
        100 /var/lib/dpkg/status

So far so good, my nginx setup is like:

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

But now if I do php -v I get:

PHP 5.6.17-0+deb8u1 (cli) (built: Jan 13 2016 09:10:12)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

And also if I serve <?php phpinfo(); ?> I get:

PHP Version     5.6.17-0+deb8u1

dpkg -l php5* | egrep ^ii outputs:

ii  php5            5.3.10-2             all          server-side, HTML-embedded scripting language (metapackage)
ii  php5-cli        5.6.17+dfsg-0+deb8u1 amd64        command-line interpreter for the php5 scripting language
ii  php5-common     5.6.17+dfsg-0+deb8u1 amd64        Common files for packages built from the php5 source
ii  php5-fpm        5.6.17+dfsg-0+deb8u1 amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5-json       1.3.6-1              amd64        JSON module for php5
ii  php5-readline   5.6.17+dfsg-0+deb8u1 amd64        Readline module for php5

So what are the necessary steps to actually run the older version of php?

Edit: I found this https://github.com/phpbrew/phpbrew really helpful tool. So if someone facing the same issue this might be a good solution.

已采纳解答

原帖链接 · Weboide · CC BY-SA 3.0

You will also need to run:

apt-get install php5-cli=5.3.10-2 php5-fpm=5.3.10-2 php5-common=5.3.10-2 php5-readline=5.3.10-2

These were still on the 5.6 version, that's why you still see 5.6.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。