PHP Parse Error Version 8.0.15

I’m trying to upgrade from version 8.0.15 to 8.0.16 (in preparation for moving to a new host, which I assume will install 8.0.16 and then allow me to upgrade to a more recent version). But I’m not able to run any of the occ commands.

I’m running on RHEL 6 (moving to 7)

Steps to reproduce

  1. cd /var/www/html/owncloud
  2. sudo -u apache php occ -V

Expected behaviour

I should see version 8.0.15 (contents of version.php)

Actual behaviour

PHP Parse error: syntax error, unexpected ‘[’ in /var/www/html/owncloud/lib/base.php on line 566

Server configuration

Operating system:
Web server:
Apache 2.2
PHP version:
ownCloud version: (see ownCloud admin page)
Updated from an older ownCloud or fresh install:
Where did you install ownCloud from:

Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
paste the results into and puth the link here.

The content of config/config.php:

<?php SCONFIG=array ( 'instanceid' =>'ocd22c41471a', 'passwordsalt' => 'nice and salty', 'trusted_domains' => array ( 0 => '', ), 'datadirectory' => 'home/owncloud/data', 'dbtype' => 'sqlite3', 'version' => '', 'installed' => true, 'forcessl' => true, 'theme' => '', 'maintenance' => false, 'share_folder' => '/Shared', 'secret' => 'Sore wa himutsu desu', 'loglevel' = 2, ); ``` Log in to the web-UI with an administrator account and click on 'admin' -> 'Generate Config Report' -> 'Download ownCloud config report' This report includes the config.php settings, the list of activated apps and other details in a well sanitized form. or If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your ownCloud installation folder *ATTENTION:* Do not post your config.php file in public as is. Please use one of the above methods whenever possible. Both, the generated reports from the web-ui and from occ config:list consistently remove sensitive data. You still may want to review the report before sending. If done manually then it is critical for your own privacy to dilligently remove *all* host names, passwords, usernames, salts and other credentials before posting. You should assume that attackers find such information and will use them against your systems. ``` **List of activated apps:** ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your ownCloud installation folder. ``` **Are you using external storage, if yes which one:** local/smb/sftp/... no **Are you using encryption:** yes/no no **Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/... #### LDAP configuration (delete this part if not used) ``` With access to your command line run e.g.: sudo -u www-data php occ ldap:show-config from within your ownCloud installation folder Without access to your command line download the data/owncloud.db to your local computer or access your SQL server remotely and run the select query: SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap'; Eventually replace sensitive data as the name/IP-address of your LDAP server or groups. ``` ### Client configuration **Browser:** **Operating system:** ### Logs #### Web server error log ``` Insert your webserver log here ``` #### ownCloud log (data/owncloud.log) ``` Insert your ownCloud log here ``` #### Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```

Looks Like there is PHP 5.4 Syntax in Base.php replace [] with array () to fix this temporarily.

1 Like

I found similar problems on lines 470, 767, 877
simplecontainer.php line 44,
util.php line 580, 787, 1298
allconfig.php line 193, 198
app.php line 1234

Now I’m stuck at:
PHP Fate error: Can’t inherit abtract function OCP\IDBConnection::beginTransaction() (previously declared abstract in Doctrine\DBAL\Driver\Connection) in /var/www/html/owncloud/lib/private/db/connection.php.

Sorry, looks like I was missing the obvious. RHEL has php 5.3 installed by default. I have 5.4 installed in an alternate channel and had configured Apache to use the newer version. However, the command line was still using the older version.

The following sequences of commands worked:
sudo su apache
source /opt/rh/php54/enable
php occ -V

The second is the key as it alters the path to point at the newer php.