title: Dealing with php5.4 on Ubuntu Trusty
body: <p>I would like to have php 5.4 on my ubuntu server, even if it's no longer supported.</p>
  
  <p>Then I tried the <a href="https://launchpad.net/~ondrej/+archive/ubuntu/php5-oldstable" rel="nofollow">ppa:ondrej/php5-oldstable</a> repository like this :</p>
  
  <pre><code>sudo add-apt-repository ppa:ondrej/php5-oldstable
  </code></pre>
  
  <p>But it adds the repository below </p>
  
  <pre><code>[ubuntu@nixmind~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list 
      deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
      # deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty 
  </code></pre>
  
  <p>main</p>
  
  <p>and was still giving php5.5.9 with <strong>apt-cache policy</strong>.</p>
  
  <pre><code>[ubuntu@nixmind ~]$ apt-cache policy php5
  php5:
    Installed: 5.4.45-3+donate.sury.org~precise+3
    Candidate: 5.5.9+dfsg-1ubuntu4.17
    Version table:
       5.5.9+dfsg-1ubuntu4.17 0
          500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
       5.5.9+dfsg-1ubuntu4 0
          500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
  </code></pre>
  
  <p>I then add the precise repos manually like this :</p>
  
  <pre><code>[ubuntu@nixmind ~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list 
  deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
  deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main 
  deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main 
  # deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
  </code></pre>
  
  <p>and had this :</p>
  
  <pre><code>[ubuntu@nixmind ~]$ apt-cache policy php5
  php5:
    Installed: (none)
    Candidate: 5.5.9+dfsg-1ubuntu4.17
    Version table:
       5.5.9+dfsg-1ubuntu4.17 0
          500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
       5.5.9+dfsg-1ubuntu4 0
          500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
       5.4.45-3+donate.sury.org~precise+3 0
          500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
  </code></pre>
  
  <p>I then installed php5.4 like this :</p>
  
  <pre><code>sudo apt-get install php5=5.4.45-3+donate.sury.org~precise+3
  </code></pre>
  
  <p>But php is saying that the version is <strong>5.5.9</strong> while <strong>apt-cache policy</strong> says it's <strong>5.4</strong></p>
  
  <pre><code>[ubuntu@nixmind ~]$ apt-cache policy php5
  php5:
    Installed: 5.4.45-3+donate.sury.org~precise+3
    Candidate: 5.5.9+dfsg-1ubuntu4.17
    Version table:
       5.5.9+dfsg-1ubuntu4.17 0
          500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
       5.5.9+dfsg-1ubuntu4 0
          500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
   *** 5.4.45-3+donate.sury.org~precise+3 0
          500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
  </code></pre>
  
  <p>and </p>
  
  <pre><code>[ubuntu@nixmind ~]$ php -v
  PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57) 
  Copyright (c) 1997-2014 The PHP Group
  Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
      with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
  </code></pre>
  
  <p>Then my questions are :</p>
  
  <ul>
  <li><p>Why is there a difference between <strong>php -v</strong> and <strong>apt-cache policy</strong>
  outputs?</p></li>
  <li><p>Is it just not possible to install php5.4 on ubuntu trusty actually?</p></li>
  <li><p>Is a good way to have php5?4 running on ubuntu trusty without this
  ambiguity?</p></li>
  </ul>
  
  <p>Regards.</p>