Nextcloud version : 15.0.12
Operating system and version : CentOS Linux 7.5.1804 (Core)
Apache or nginx version : Apache 2.4.6
PHP version : 7.3.10 as FPM application served by Apache
Hello,
The issue you are facing:
Is this the first time you’ve seen this error? (Y/N): Y
I’ve upgraded my Nexcloud instance from 14.x to 15.0.12. I get some warning about missing index, and columns not being converted in big int. I’ve used the occ command as was mentionned in the warning, and I get that (what I show you is for missing indexes, but I get the same problem for all occ commands) :
sudo -u apache php ./occ db:add-missing-indices
PHP Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or ‘{’ or ‘$’ in /var/www/vhosts/madonie.org/subdomains/nuage/console.php on line 93
I do the upgrade manually, since I always get an error message at the backup step of the web upgrade.
I guess I have to solve this problem before upgrading to 16.x, and eventually 17.x after.
I’m doing that in the Nextcloud folder.
No Docker. I just download the zip archive of Nextcloud and upload its content in the Nextcloud folder. I don’t know what you mean by snap.
I don’t think your message includes the cli version of PHP. There is a difference between the PHP Apache uses and the PHP you run in the terminal. Your issue is most likely due to a problem with the CLI version of PHP that you are using. Did you try running php -v to see what version that is?
Either way, the error message you posted is a syntax error which can only be one of two things: the code is broken or the code is incompatible with the version of PHP used to run it.
Thank you for your explanation. You’re right, php client was an old version :
php -v
PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51)
Trying to know why, I’ve learnt two things :
I’m using Plesk, and it installs several version of PHP in its own directory :
ls /opt/plesk/php/
5.6 7.0 7.1 7.2 7.3
So it was not the /usr/bin/php I should have used, but the one in the bin directory of the PHP version I use. In my case :
/opt/plesk/php/7.3/bin/php
Using PHP as FPM application served by Apache, I haven’t changed the ownership and the permissions of the files and folders of Nextcloud. So it was not Apache user I had to use, but my username in sudo. For example :
But I don’t think it’s a good idea to run the nextcloud with your username. Give it a dedicated username like www-nextcloud, the nextcloud folder and the data folder should be owned by that user. This is for security.
In fact, it’s not the username I use to connect with ssh to my server. It’s the ftp user for the domain nextcloud is part of. Do you mean it would be more secure to have a ftp user just for Nextcloud ?
No I mean a total separate user that is only used for nextcloud. I do not use ftp at all, because it is insecure too. You can do all configuration via ssh and use sudo to write to the nextcloud directories.
According to the recommendations, I can change the type of database (default SQLlite), create the required indexes … But none of the operations does not work
for example:
[~] # /opt/NextCloud/nextcloud/occ db:convert-type
env: php: No such file or directory
What to do? Where and what to change? (To provide the necessary information is not a problem)