Problem to change PHP version

NethServer Version: 7.7
Module: PHP-CLI

I made the installation in PHP CLI I accessed the settings and changed the version of php to 7.3, but in the terminal when checking the version appears as php 5.4, I need to change to php 7.3 to run OCC commands

You’re checking incorrectly.

No you don’t; you just need to run them correctly. See here:
https://wiki.nethserver.org/doku.php?id=howto:nextcloud

1 Like

Thank you, I solved and learned, I will study the documentation more.

Hi onlitec,

If you want to use php-7.3 without having to specify it every time, you can have a look at: http://appdev.oit.umn.edu/2015/02/11/scl/

In my case, on the command line, I have PHP-7.2 by default:

cat > /etc/profile.d/activer-php72.sh <<'EOT'
#!/bin/bash
source /opt/remi/php72/enable
if [[ "$X_SCLS" != *php72* ]]; then
src="`scl enable php72 'echo $X_SCLS'`"
pkgs=(${src// / })
uniq=($(printf "%s\n" "${pkgs[@]}" | sort -u));
export X_SCLS="${uniq[@]}"
fi
EOT

Make the script executable.

chmod +x /etc/profile.d/activer-php72.sh

Close the connection and login again.

Then, check the default PHP:

# which php

/opt/remi/php72/root/usr/bin/php
#

And its version:

# php --version

PHP 7.2.18 (cli) (built: Apr 30 2019 14:41:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
#

Michel-André

1 Like

Great I used it this way and everything worked out, thanks for the support