I want to study some security vulnerabilities in php 5.2.17, but I can't install it from source, because then I need also all the older versions of all the other application which have something to do with php. How I can install an older version of php in the easiest way? For example in a virtual machine which is compatible with that?

  • Install an older OS that still has that version available for it or build it yourself. I'm not sure what you mean about needing to install all the older versions when building from source because that's precisely what you're going to have to do if you try to force a package install of an old version.
    – user143703
    May 23, 2016 at 17:23
  • you can compile php-5.2.17 from source and use it as cgi on any modern distro.
    – ALex_hha
    May 23, 2016 at 21:40

2 Answers 2


apt-cache policy php5 will show you the available versions on Debian systems. Then you can install with apt-get install -y php5=whatever_version.

On Fedora deriviatives you can use yum --showduplicates list php does the same and you can install a specific version using yum install -y php-whatever_version

If the version you need is not available after running the first command then you need to find and add the repositories that contain the version you are looking for and try again.

After adding a software repository, make sure you do:

apt-get update (Debian) or yum check-update (Fedora_ to update your local package lists or your new software may not show up in the package lists still.


  • Here is link how to use two version of php on same ubuntu. askubuntu.com/questions/50344/… Another option is to use of Docker container instead of a virtual machine. hub.docker.com/r/tommylau/php-5.2
    – stambata
    May 23, 2016 at 21:30
  • If you are running Ubuntu and want to use a container there is literally no reason to set up Docker since LXD is native now unless you just want to play with Docker.
    – spyderdyne
    May 23, 2016 at 21:31

Create a virtual machine with virtualbox or VmWare Workstation (paid) and download an older version of CentOS 5 then download PHP 5.2.17 and install it normally .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.