FS#69464 - [nextcloud] occ utility uses PHP 8 instead of PHP 7 and thus fails version check

Attached to Project: Community Packages
Opened by rio (rio) - Friday, 29 January 2021, 09:55 GMT
Last edited by David Runge (dvzrv) - Saturday, 20 February 2021, 11:13 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
David Runge (dvzrv)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 6
Private No

Details

Description:

While the nextcloud packages have been changed to depend on the new php7 packages during migration to PHP 8, the occ script still has the following shebang:

#!/usr/bin/env php

Thus, for users with php 8 installed, this will run occ using php 8 instead of php7, which fails the version check. Users are only able to use occ after changing php to php7 in the shebang.

Additional info:
* nextcloud 20.0.6-1
This task depends upon

Closed by  David Runge (dvzrv)
Saturday, 20 February 2021, 11:13 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with nextcloud >= 21.0.0-2
Comment by emilio reggi (emilio-r) - Sunday, 31 January 2021, 20:27 GMT
Same is true for cron.php, which also fails the version check.

* nextcloud 20.0.6-1
Comment by rio (rio) - Sunday, 31 January 2021, 20:31 GMT
Well, cron.php has no reference to which interpreter is to be used, you should just run it with php7.

I have noticed though that the scripts in aur/nextcloud-systemd-timers are not using php7 either. (Checked again, they are using php7 now.)
Comment by emilio reggi (emilio-r) - Sunday, 31 January 2021, 21:04 GMT
Yes, sorry, I just realized that I manually installed my cron service file, so my above comment is invalid - thanks!
Comment by Aleš Ferlan (Alko89) - Saturday, 06 February 2021, 23:00 GMT
I tried upgrading it with php7 but get an exception and I also get error in the browser that its running with php8:

sudo /usr/bin/runuser -u http -- /usr/bin/php7 -d memory_limit=1024M /usr/share/webapps/nextcloud/occ upgrade
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /usr/share/webapps/nextcloud/lib/private/DB/Connection.php:72
Stack trace:
#0 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1449): OC\DB\Connection->connect()
#1 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(892): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /usr/share/webapps/nextcloud/lib/private/DB/Connection.php(202): Doctrine\DBAL\Connection->executeQuery()
#3 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(206): OC\DB\Connection->executeQuery()
#4 /usr/share/webapps/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(217): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /usr/share/webapps/nextcloud/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /usr/share/webapps/nextcloud/lib/private/AppConfig.php(110): OC\AppConfig->loadConfigValues()
#7 /usr/share/webapps/nextcloud/lib/private/AppConfig.php(301): OC\AppConfig->getApps()
#8 /usr/share/webapps/nextcloud/lib/private/legacy/OC_App.php(949): OC\AppConfig->getValues()
#9 /usr/share/webapps/nextcloud/lib/private/Server.php(668): OC_App::getAppVersions()
#10 /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}()
#11 /usr/share/webapps/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#13 /usr/share/webapps/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query()
#14 /usr/share/webapps/nextcloud/lib/private/Server.php(1677): OC\ServerContainer->query()
#15 /usr/share/webapps/nextcloud/lib/private/Server.php(1017): OC\Server->getMemCacheFactory()
#16 /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}()
#17 /usr/share/webapps/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#18 /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#19 /usr/share/webapps/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query()
#20 /usr/share/webapps/nextcloud/lib/private/Server.php(1977): OC\ServerContainer->query()
#21 /usr/share/webapps/nextcloud/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#22 /usr/share/webapps/nextcloud/lib/private/Server.php(395): OC\Files\View->__construct()
#23 /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}()
#24 /usr/share/webapps/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#25 /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#26 /usr/share/webapps/nextcloud/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query()
#27 /usr/share/webapps/nextcloud/lib/private/Server.php(1324): OC\ServerContainer->query()
#28 /usr/share/webapps/nextcloud/lib/base.php(595): OC\Server->boot()
#29 /usr/share/webapps/nextcloud/lib/base.php(1091): OC::init()
#30 /usr/share/webapps/nextcloud/console.php(49): require_once('/usr/share/weba...')
#31 /usr/share/webapps/nextcloud/occ(11): require_once('/usr/share/weba...')
#32 {main}%
Comment by rio (rio) - Sunday, 07 February 2021, 08:29 GMT
Alko89, make sure to install the necessary php7-* packages and have the extensions enabled in /etc/php7/php.ini. (You might just copy your "old" config files from /etc/php and change the extension_dir to "/usr/lib/php7/modules/")
Comment by Aleš Ferlan (Alko89) - Sunday, 07 February 2021, 14:11 GMT
Ahhh, yes...derp...obviously there is a new config folder now for php7 :D Thanks rio.

Got it working after setting the configs and updating nginx conf to use php-fpm7 and updating cron.
Comment by anon anon (pwdsax6n1) - Sunday, 07 February 2021, 20:39 GMT
Aleš Ferlan (Alko89) -: how did you get it working? I get the same error `could not find driver in /usr/share/webapps/nextcloud/lib/private/DB/Connection.php:72` even though I copied my /etc/php/php.ini to /etc/php7/php.ini which should have all extensions in use. Im an using mariaDb
Comment by Aleš Ferlan (Alko89) - Sunday, 07 February 2021, 20:43 GMT
anon anon (pwdsax6n1) if you copied the /etc/php/php.ini, then you should also fix the extension_dir = "/usr/lib/php/modules/" line to extension_dir = "/usr/lib/php7/modules/"
Comment by David Runge (dvzrv) - Saturday, 20 February 2021, 11:12 GMT
I have added a convenience wrapper script around the occ command in /usr/bin/occ.
It allows overriding of php.ini, php command and user and thus should be able to allow us to get around patches of the occ command in the future.

Loading...