Php 5 - php 7 how to migrate

Hello

I have a debian server with nextcloud 13.

I have php5 and php7 install.
I would like to activate php7 for nextcloud, how?

Thank you

Run php -v to see the running version.

There is nothing you have to do in NC itself, it works with php 5.6 as well as with php 7.0. You just need to tell your webserver to use php 7.

Hello,
Should you uninstall php5 for php7 to work, because when i activate the php7 module, nextcloud does not work anymore …?

When I used external sources in debian for php, I just disabled the php5-module and enabled the php7 module. I would try the php7 module before uninstalling php5.

As soon as Debian Stretch came out, I upgrade because it comes with native php7 support. I didn’t want to rely on 3rd-party packages and it makes many things a bit easier.

But only up to NC 13!

I’ve been meaning to upgrade from PHP 5.6 to 7.1 for ages, but never got around to it. A couple of days ago I noticed a warning in NC’s “Security & setup warnings” saying the current version of NC is the last to support PHP5.6.

@dodo The method of upgrading PHP depends on your OS/distro and webserver. For example, I’m running FreeBSD and Apache, so I used portmaster to switch the PHP origin port, then I uninstalled 5.6 and installed 7.1 (along with 7.1’s Apache mod). Done.

I haven’t used Debian since 2004, so I can’t offer any relevant advice, sorry :frowning:

That’s correct. NC 14 is not out yet and it will probably take a couple of months. The warning is on purpose that you won’t be surprise when the next update is coming so you have enough time to plan your upgrade to PHP 7.0 or higher (NC 13 will be supported until NC 15 is released).

Which I’m really grateful for! I wouldn’t have known or realised until I tried updating, only to have the update fail.

I think I originally went with PHP 5.6 because Roundcube wasn’t 7 compatible at the time (a couple of years back). Thankfully everything supports 7.1 now so I shouldn’t have to think about upgrading PHP again for several more years :stuck_out_tongue:

Hello,

Thank you for your answers,
I am on debian 9.
I will try to uninstall php 5 and install php 7. I will keep you informed.
I too have the warning :

You are currently using PHP 5.6.33-0 + deb8u1. Update your version of PHP to take advantage of the performance and security enhancements provided by the PHP Group as soon as your distribution supports it.
You are currently using PHP 5.6. The current major version of Nextcloud is the latest that is supported under PHP 5.6. It is recommended to upgrade PHP to 7.0+ to upgrade to Nextcloud 14.

I have php5 and php7 installed, but NC13 uses php5.

$ dpkg -l | grep php
ii  libapache2-mod-php5                   5.6.33+dfsg-0+deb8u1              armhf        server-side, HTML-embedded scripting language (Apache 2 module)
rc  owncloud-deps-php5                    9.0.9-1.1                         all          ownCloud - dependencies for php5
ii  php-apc                               4.0.7-1                           all          APC User Cache for PHP 5 (transitional package)
ii  php-cli                               1:7.0+49                          all          command-line interpreter for the PHP scripting language (default)
ii  php-common                            1:49                              all          Common files for PHP packages
ii  php-pear                              1:1.10.1+submodules+notgz-9       all          PEAR Base System
ii  php-xml                               1:7.0+49                          all          DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii  php-xml-parser                        1.3.6-1                           all          XML parsing class based on PHP's bundled expat
ii  php5                                  5.6.33+dfsg-0+deb8u1              all          server-side, HTML-embedded scripting language (metapackage)
ii  php5-apcu                             4.0.7-1                           armhf        APC User Cache for PHP 5
ii  php5-cgi                              5.6.33+dfsg-0+deb8u1              armhf        server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                              5.6.33+dfsg-0+deb8u1              armhf        command-line interpreter for the php5 scripting language
ii  php5-common                           5.6.33+dfsg-0+deb8u1              armhf        Common files for packages built from the php5 source
ii  php5-curl                             5.6.33+dfsg-0+deb8u1              armhf        CURL module for php5
ii  php5-gd                               5.6.33+dfsg-0+deb8u1              armhf        GD module for php5
ii  php5-intl                             5.6.33+dfsg-0+deb8u1              armhf        internationalisation module for php5
ii  php5-json                             1.3.6-1                           armhf        JSON module for php5
ii  php5-ldap                             5.6.33+dfsg-0+deb8u1              armhf        LDAP module for php5
ii  php5-mcrypt                           5.6.33+dfsg-0+deb8u1              armhf        MCrypt module for php5
ii  php5-mysqlnd                          5.6.33+dfsg-0+deb8u1              armhf        MySQL module for php5 (Native Driver)
ii  php5-pgsql                            5.6.33+dfsg-0+deb8u1              armhf        PostgreSQL module for php5
ii  php5-readline                         5.6.33+dfsg-0+deb8u1              armhf        Readline module for php5
ii  php5-sqlite                           5.6.33+dfsg-0+deb8u1              armhf        SQLite module for php5
ii  php7.0-cli                            7.0.27-0+deb9u1                   armhf        command-line interpreter for the PHP scripting language
ii  php7.0-common                         7.0.27-0+deb9u1                   armhf        documentation, examples and common module for PHP
ii  php7.0-curl                           7.0.27-0+deb9u1                   armhf        CURL module for PHP
ii  php7.0-gd                             7.0.27-0+deb9u1                   armhf        GD module for PHP
ii  php7.0-intl                           7.0.27-0+deb9u1                   armhf        Internationalisation module for PHP
ii  php7.0-json                           7.0.27-0+deb9u1                   armhf        JSON module for PHP
ii  php7.0-mbstring                       7.0.27-0+deb9u1                   armhf        MBSTRING module for PHP
ii  php7.0-mysql                          7.0.27-0+deb9u1                   armhf        MySQL module for PHP
ii  php7.0-opcache                        7.0.27-0+deb9u1                   armhf        Zend OpCache module for PHP
ii  php7.0-readline                       7.0.27-0+deb9u1                   armhf        readline module for PHP
ii  php7.0-xml                            7.0.27-0+deb9u1                   armhf        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.0-zip                            7.0.27-0+deb9u1                   armhf        Zip module for PHP

$ php -v 
PHP 7.0.27-0+deb9u1 (cli) (built: Jan  5 2018 13:51:52) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.27-0+deb9u1, Copyright (c) 1999-2017, by Zend Technologies

Installed possible missing dependencies
sudo apt install php7.0 php7.0-sqlite php7.0-intl php7.0-pgsql libmcrypt4 php-xml-parser php7.0-mcrypt php7.0-mysqlnd

sudo service apache2 restart

    You are currently running PHP 5.6.33-0+deb8u1. Upgrade your PHP version to take advantage of performance and security updates provided by the PHP Group as soon as your distribution supports it.
    You are currently running PHP 5.6. The current major version of Nextcloud is the last that is supported on PHP 5.6. It is recommended to upgrade the PHP version to 7.0+ to be able to upgrade to Nextcloud 14.

At default-ssl.conf is no php version listed.

I am not shure why?


switched to php7 with:

sudo apt purge php5*
sudo apt-get install php7.0-xml php7.0 php7.0-cgi php7.0-cli php7.0-gd php7.0-curl php7.0-zip php7.0-mysql php7.0-mbstring
sudo systemctl restart apache2

Did you ever figure this out? Running into the same issue. I’m using nginx rather than apache and do concede this is a web server config rather than anything else so may be different, but surely there must be a standard way to modify the fastcgi/fpm setup from one version of php to another? Haven’t found one yet!