owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.36k stars 2.06k forks source link

Trouble running "php occ" inside docker image #36240

Closed marcus-herrmann closed 4 years ago

marcus-herrmann commented 5 years ago
### Steps to reproduce 1. Install 10.3 alpha2 via docker: ``` docker run --rm -d \ --name owncloud2 \ -p 18080:8080 \ -e OWNCLOUD_APPS_INSTALL=oauth2 \ -e ADMIN_USERNAME=admin \ -e ADMIN_PASSWORD=admin \ owncloud/server:10.3.0-alpha2``` 2. `docker exec -it owncloud2 /bin/bash` 3. `$ php occ`(by instructions given here [3rd step in installation] docker exec -it owncloud2 /bin/bashhttps://github.com/owncloud/testing Just using `$ occ` works though. ### Expected behaviour `$ occ` and `$ php occ` should work both ### Actual behaviour `$ php occ` returns with or without further commands: ``` An unhandled exception has been thrown: OC\DatabaseException: Invalid database type in /var/www/owncloud/lib/private/Server.php:529 Stack trace: #0 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server)) #1 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('DatabaseConnect...') #2 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...') #3 /var/www/owncloud/lib/private/Server.php(1219): OC\ServerContainer->query('DatabaseConnect...') #4 /var/www/owncloud/lib/private/Server.php(406): OC\Server->getDatabaseConnection() #5 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server)) #6 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppConfig') #7 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppConfig') #8 /var/www/owncloud/lib/private/Server.php(1149): OC\ServerContainer->query('AppConfig') #9 /var/www/owncloud/lib/private/Server.php(587): OC\Server->getAppConfig() #10 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server)) #11 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppManager') #12 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppManager') #13 /var/www/owncloud/lib/private/Server.php(1417): OC\ServerContainer->query('AppManager') #14 /var/www/owncloud/lib/private/legacy/app.php(343): OC\Server->getAppManager() #15 /var/www/owncloud/lib/private/legacy/app.php(107): OC_App::getEnabledApps() #16 /var/www/owncloud/lib/base.php(582): OC_App::loadApps(Array) #17 /var/www/owncloud/lib/base.php(1002): OC::init() #18 /var/www/owncloud/console.php(64): require_once('/var/www/ownclo...') #19 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...') #20 {main} ``` ### Server configuration **Operating system**: Inside docker: Ubuntu I guess **Web server:** Inside docker: Apache I guess **Database:** Inside docker: sqlite **PHP version:** Inside docker: PHP 7.2.19-0ubuntu0.18.04.1 (cli) **ownCloud version:** (see ownCloud admin page) 10.3.0 alpha2 **Updated from an older ownCloud or fresh install:** Fresh **Where did you install ownCloud from:** See steps to reproduce 1. ``` Login as admin user into your ownCloud and access http://example.com/index.php/settings/integrity/failed paste the results into https://gist.github.com/ and puth the link here. ``` **The content of config/config.php:** ``` { "system": { "apps_paths": [ { "path": "\/var\/www\/owncloud\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/owncloud\/custom", "url": "\/custom", "writable": true } ], "trusted_domains": [ "localhost" ], "datadirectory": "\/mnt\/data\/files", "dbtype": "sqlite", "dbhost": "", "dbname": "owncloud", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "log_type": "owncloud", "supportedDatabases": [ "sqlite", "mysql", "pgsql" ], "upgrade.disable-web": true, "default_language": "en", "overwrite.cli.url": "http:\/\/localhost\/", "htaccess.RewriteBase": "\/", "logfile": "\/mnt\/data\/files\/owncloud.log", "loglevel": 2, "memcache.local": "\\OC\\Memcache\\APCu", "filelocking.enabled": true, "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "version": "10.3.0.2", "logtimezone": "UTC", "installed": true, "instanceid": "ocaurubop745", "phoenix.baseUrl": "http:\/\/0.0.0.0:8300", "cors.allowed-domains": [ "http:\/\/0.0.0.0:8300" ], "skeletondirectory": "\/var\/www\/owncloud\/apps\/testing\/data\/webUISkeleton" } } ``` **List of activated apps:** ``` Enabled: - comments: 0.3.0 - configreport: 0.2.0 - dav: 0.4.0 - federatedfilesharing: 0.5.0 - federation: 0.1.0 - files: 1.5.2 - files_external: 0.7.1 - files_mediaviewer: 1.0.0 - files_sharing: 0.12.0 - files_trashbin: 0.9.1 - files_versions: 1.3.0 - firstrunwizard: 1.2.0 - market: 0.5.0 - notifications: 0.5.0 - oauth2: 0.4.1 - provisioning_api: 0.5.0 - systemtags: 0.3.0 - testing: 0.1.0 - updatenotification: 0.2.1 Disabled: - encryption - external - files_external_s3 - user_external - user_ldap ``` **Are you using external storage, if yes which one:** no **Are you using encryption:** no **Are you using an external user-backend, if yes which one:** no
TheCelavi commented 4 years ago

I can confirm same behaviour, running command "occ ...." does not throws an error, while "php occ..." does.

DeepDiver1975 commented 4 years ago

You are most probably running the command under the wrong user id or you are missing to initialize other environment variables

Never the less - the occ script was added on purpose so that you don't need to care about what needs to be done - https://github.com/owncloud-docker/base/blob/master/latest/overlay/usr/bin/occ

Please just use the script and we are all happy ;-)

DeepDiver1975 commented 4 years ago

Just in case you what to know what else might be missing - these are some of the initialization scripts: https://github.com/owncloud-docker/base/tree/master/latest/overlay/etc/entrypoint.d

As said - occ is there on purpose - please just use as is

TheCelavi commented 4 years ago

@DeepDiver1975 yeah, my thought exactly - thanks for quick response.