For instance, say hypothetically (or in reality) one was using and needed to continue using Debian Jessie, but wanted to utilize PHP7 from Debian Stretch. They might edit /etc/apt/sources.list
to use Stretch and install the new software and then revert /etc/apt/sources.list
back to Jessie. But would they also need to do the same for nginx or other packages? If so, how would they know? And would they wish to perform an apt-get update
during the time they were configured to use Stretch?

- 1,897
- 6
- 31
- 36
1 Answers
Here’s what to look out for when mixing stable releases: don’t.
What’s more, adding a different release to sources.list
temporarily is a really bad idea, because you won’t get any updates to the packages you pull in from that different release. If you really do want to go down this route, set up pinning properly and enable the new release permanently.
However, I’ll say it again: don’t do this. If you want PHP 7 from Debian 9, upgrade to Debian 9, or request a proper backport to Debian 8 (and accept that the answer might well be “no”).
Regarding your specific questions, if other packages need to be upgraded, apt
& co. will tell you. You need to run apt update
after changing sources.list
for the changes to take effect; if you’re referring to apt upgrade
, if you run that with Debian 9 in your repositories and no pinning, you’ll upgrade to Debian 9 as far as possible without deleting packages (you’d need dist-upgrade
for a full upgrade).

- 434,908
sudo apt-get update && sudo apt-get install nginx sqlite3 php7.0 php7.0-common php7.0-curl php7.0-fpm php7.0-cli php7.0-opcache php7.0-sqlite3
, then reverted back to Jessie, and executedsudo apt-get update && sudo apt-get dist-upgrade
(where the later showed zero changes as I had hoped). I hear you saying even pinning is not ideal, right? Maybe I should just install from source? – user1032531 Dec 08 '17 at 11:59apt-cache policy
(with no other arguments). That way if updates are released forphp7.0
,nginx
orsqlite3
, or their Stretch-based dependencies, you’ll get them, but you won’t get anything else. – Stephen Kitt Dec 08 '17 at 13:29