0

I need to upgrade php 5.4 to 5.6 to use my framework magento 2. I apply these commands :

echo "deb http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list echo "deb-src http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list wget http://www.dotdeb.org/dotdeb.gpg -O- | apt-key add - apt-get update apt-get install php5-cli php5-fpm

It works I have that now in SSH :

# php -v
PHP 5.6.30-1~dotdeb+7.1 (cli) (built: Jan 21 2017 14:50:59)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

But Magento 2 does not works and when I put echo phpversion(); in the index.php, I have this version ! 5.4.45-0+deb7u5

I am on debian and I do not understand how I can have 2 other php versions on the same server

Can you help me ?

EDIT:

Content of /etc/apache2/mods-available :

actions.conf          deflate.conf               php5_cgi.load.dpkg-remove
actions.load          deflate.load               php5.conf
alias.conf            dir.conf                   php5.conf.dpkg-new
alias.load            dir.load                   php5.load
asis.load             disk_cache.conf            php5.load.dpkg-new
auth_basic.load       disk_cache.load            proxy_ajp.load
auth_digest.load      dump_io.load               proxy_balancer.conf
authn_alias.load      env.load                   proxy_balancer.load
authn_anon.load       expires.load               proxy.conf
authn_dbd.load        ext_filter.load            proxy_connect.load
authn_dbm.load        file_cache.load            proxy_ftp.conf
authn_default.load    filter.load                proxy_ftp.load
authn_file.load       headers.load               proxy_http.load
authnz_ldap.load      ident.load                 proxy.load
authz_dbm.load        imagemap.load              proxy_scgi.load
authz_default.load    include.load               reqtimeout.conf
authz_groupfile.load  info.conf                  reqtimeout.load
authz_host.load       info.load                  rewrite.load
authz_owner.load      ldap.conf                  setenvif.conf
authz_user.load       ldap.load                  setenvif.load
autoindex.conf        log_forensic.load          speling.load
autoindex.load        mem_cache.conf             ssl.conf
cache.load            mem_cache.load             ssl.load
cern_meta.load        mime.conf                  status.conf
cgid.conf             mime.load                  status.load
cgid.load             mime_magic.conf            substitute.load
cgi.load              mime_magic.load            suexec.load
charset_lite.load     negotiation.conf           unique_id.load
dav_fs.conf           negotiation.load           userdir.conf
dav_fs.load           php5_cgi.conf.dpkg-new     userdir.load
dav.load              php5-cgi.conf.dpkg-new     usertrack.load
dav_lock.load         php5_cgi.conf.dpkg-remove  vhost_alias.load
dbd.load              php5_cgi.load.dpkg-new

Content of /etc/apache2/mods-enabled :

alias.conf            autoindex.load  mime.conf         setenvif.conf
alias.load            cgi.load        mime.load         setenvif.load
auth_basic.load       deflate.conf    negotiation.conf  ssl.conf
authn_file.load       deflate.load    negotiation.load  ssl.load
authz_default.load    dir.conf        php5.conf         status.conf
authz_groupfile.load  dir.load        php5.load         status.load
authz_host.load       env.load        reqtimeout.conf
authz_user.load       expires.load    reqtimeout.load
autoindex.conf        headers.load    rewrite.load
  • Take a look at which version of PHP Apache is configured for. Check in /etc/apache2/mods-enabled vs. what is in mods-available, and a2enmod/a2dismod as needed – ivanivan Mar 7 '17 at 18:28
  • in /etc/apache2/mods-enabled/php5.load : LoadModule php5_module /usr/lib/apache2/modules/libphp5.so In /mods-available/php5.load LoadModule php5_module /usr/lib/apache2/modules/libphp5.so – user3908398 Mar 8 '17 at 21:37
  • The content of the actual file will be the same between mods-available and mods-enabled - the enabled are just symlinks back to -available. But if you get a directory listing, are there any other php related modules in -available? Alternatively use dpkg to show a listing of what files the php56 package(s) own – ivanivan Mar 8 '17 at 21:44
  • I add folder content in top subject, I think there is php5_cgi and php5 But I do not know which one I must delete and how – user3908398 Mar 8 '17 at 22:37
  • Gentoo allows to have different PHP versions on a single server, just saying :) – Anubioz Mar 8 '17 at 22:43
0

In default installation, php is installed as apache-module. e.g. package libapache2-mod-php5

other possibilities to include php to apache could be cgi, fast-cgi, fcgid... (here you have to search in the *cgi*-config for the path to the php-binary. But I guess you are using php as apache module so check the following.

search for php-packages:

# dpkg -l | grep php
ii  libapache2-mod-php5                      5.6.29-1~dotdeb+7.1 [...]

if you have not this version number, check if the package is installed from the dotdebian-repository. (the default selected version for install is marked with *** before the version number)

You could check from which repository a package would be installed with apt-cache.

# apt-cache policy libapache2-mod-php5

Installing a package from an explicit repository could be done with the -t switch

# apt-get -t wheezy-php56 install libapache2-mod-php5

what about the php on commandline?

when you run "php" on commandline another binary is executed.

find out which binary is used and which packaged installed it:

# dpkg -S $(readlink -f $(which php))
php5-cli: /usr/bin/php5

In this example, the package php5-cli ships the binary used when typing "php" in the console.

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.