Try to execute ssh command sudo -u http php /volume1/web/nextcloud/occ status
Actual behaviour
When executing the occ status command or any other occ command, i am getting the following error message:
An unhandled exception has been thrown:
exception ‘Exception’ with message ‘Environment not properly prepared.’ in /volume1/web/nextcloud/lib/private/Console/Application.php:145
Stack trace: #0 /volume1/web/nextcloud/console.php(91): OC\Console\Application-loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #1 /volume1/web/nextcloud/occ(11): require_once(‘/volume1/web/ne…’)
With phpinfo i found out that my PHP user is http. Complete nextcloud folder is owned by http user.b
Server configuration
Operating system: Synology DSM newest version
Web server: Apache 2
Database: Sqlite3 12.0.0.29
PHP version: php5.6.11
Nextcloud version: nextcloud 12.0.0
Updated from an older Nextcloud/ownCloud or fresh install: fresh install
In recent versions, Nextcloud does not support php 5.6 any more. Using the above command with php70 instaed triggers a long error message, basically due to some modules (namely database connection) are missing. I have activated all necessary modules in the Web Station PHP configuration, but that configuration is apparently not used if php is called via the command line.
Any idea how to get the command line running with Nextcloud 15?
The php configs are located at /var/packages/WebStation/etc/php_profile/xxxx/conf.d/, where xxxx are some random letters. Find the right folder with your configuration by comparing the content of the file user_settings.ini with the choice of modules in WebStation.
Create a new file with the following content (replace xxxx with your random letters!):
@d-tamm
If you install the php 7.2 package from package center you can use the command again by typing php72 occ or php70 occ, had the same problem and workaround
No, does not work for me. I get a long error stack message, slightly different for php 7.0 and php 7.2.
php70:
# sudo -u http php70 occ
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /volume1/web/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
…
php72:
# sudo -u http php72 occ
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /volume1/web/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
…
Also, the workaround described above (shell script) does not work for me with php72. php70 works fine.
I have NC 15.0.7 running with PHP 7.2 on Synology DS418.
Problems are typically caused by php settings and (missing) modules.
I have a writeup how I did it, it may be helpful.