My server is running debian 7 and I have php 5.4.45 installed via apt-get. I need php 5.6 for some other service to run properly, but unfortunately I couldn't find any way to install it via apt-get. I've downloaded, compiled and installed php 5.6 and php -v shows:

PHP 5.6.29 (cli)

Unfortunately, since the version installed via apt-get is still accessible via php5 command, apache uses the old 5.4.45. I cannot get rid of this, because there are other things depending on it that I don't want to lose.
I've read other answers, but I didn't find httpd config files anywhere on my device.
Another thing, how can I "tell" apt-get or any other package manager, that I've installed newer version of php manually, so that it doesn't require me to download older version, just to satisfy the dependence. Is it that the name is incorrect, do I need to link it somewhere? If there is some article, that explains it, please link it.

  • apt-get dist-upgrade, will upgrade your php from 5.4 to 5.6.
    – Orphans
    Dec 27, 2016 at 14:15
  • It would also upgrade me to debian 8, wouldn't it? I've had troubles with getting some stuff to work on jessie, so I want to stick with wheezy
    – fulaphex
    Dec 27, 2016 at 14:21
  • No, that would require you to change your repos to Jessie, which I guess you have not done.
    – Orphans
    Dec 27, 2016 at 14:40
  • I haven't changed the repos. What would dist-upgrade do then?
    – fulaphex
    Dec 27, 2016 at 14:41
  • askubuntu.com/questions/81585/…
    – Orphans
    Dec 27, 2016 at 14:43

1 Answer 1


If you installed another version of PHP and assuming you parse php with mod_php, you just have to load the module from the new installation.

Also, Apache distribution always comes with a file called "envvars", this loads the environment variables you want/need for apache to run with. This file is ran when Apache HTTPD is started.

In this file you can specify, PATH, LD_LIBRARY_PATH, etc. Do you follow? Just specify the paths for the new PHP installation there, and in the Apache configuration use the LoadModule direcitive to load the appropiate file.

  • To be honest, I don't think I follow. I have both php and php5 in my PATH. php is 5.6, php5 is 5.4. I don't know what modules should be loaded.
    – fulaphex
    Jan 30, 2017 at 18:58

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.