PHP auf der Kommandozeile bei Strato

Versucht man die Kommandozeilentools von NextCloud occ und updater.phar bei Strato zu benutzen dann bekommt man so nette Fehlermeldungen:

> php updater/updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4
Current version is 20.0.3.
Update to Nextcloud 20.0.12 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-20.0.12.zip
Open changelog ↗
Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done
Start update? [y/N] PHP Warning:  Use of undefined constant STDIN - assumed 'STDIN' (this will throw an Error in a future version of PHP) in phar:///mnt/web120/e2/56/510XXX56/htdocs/cloud/updater/updater.phar/vendor/symfony/console/Helper/QuestionHelper.php on line 117
PHP Warning:  fgets() expects parameter 1 to be resource, string given in phar:///mnt/web120/e2/56/510XXX56/htdocs/cloud/updater/updater.phar/vendor/symfony/console/Helper/QuestionHelper.php on line 133
[RuntimeException]
Aborted
update [--no-backup]
X-Powered-By: PHP/7.4.23
Content-type: text/html

oder bei occ:

php occ upgrade
X-Powered-By: PHP/7.4.23
Content-type: text/html
An unhandled exception has been thrown:
TypeError: Return value of OC\AppFramework\Http\Request::getScriptName() must be of the type string, null returned in /mnt/web120/e2/56/51008256/htdocs/WordPress-WH3/cloud/lib/private/AppFramework/Http/Request.php:837
Stack trace:
#0 /mnt/web120/e2/56/510XXX56/htdocs/cloud/lib/base.php(163): OC\AppFramework\Http\Request->getScriptName()
#1 /mnt/web120/e2/56/510XXX56/htdocs/cloud/lib/base.php(576): OC::initPaths()
#2 /mnt/web120/e2/56/510XXX56/htdocs/cloud/lib/base.php(1091): OC::init()
#3 /mnt/web120/e2/56/510XXX56/htdocs/cloud/console.php(49): require_once('/mnt/web120/e2/...')
#4 /mnt/web120/e2/56/510XXX56/htdocs/cloud/occ(11): require_once('/mnt/web120/e2/...')
#5 {main}

Dazu kommt, dass die PHP-Version nicht unbedingt zur Version passt, die für den Webspace eingestellt ist (in diesem Fall wäre es eigentlich PHP 7.3 gewesen).

Ein funktionierendes PHP-Binary findet man unter /opt/ in einem Versionsspezifischen Ordner:

/opt/RZphp73/bin/php-cli occ db:add-missing-indices
The current PHP memory limit is below the recommended value of 512MB.
Check indices of the share table.
Check indices of the filecache table.
Adding additional size index to the filecache table, this can take some time...
Filecache table updated successfully.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Check indices of the schedulingobjects table.
Check indices of the oc_properties table.

Damit funktionieren sowohl occ als auch updater.phar einwandfrei 🙂