--- date: 2019-05-02T23:11:15+01:00 description: "Howto resolve the problem for occ command Nextcloud, under chroot OpenBSD" draft: false tags: ["Nextcloud", "chroot", "OpenBSD", "tip"] title: "(tip) Nextcloud Php Chroot OpenBSD" translationKey: "openbsd-nextcloud-php-chroot" --- ## Error: Invalid data directory Under OpenBSD, Web service and PHP are under chroot. In fact, the command `occ` can not run! When you try, we get this message: {{< code "web-nextcloud-php-chroot-error" sh >}} **To resolve this problem is very easy!** Edit the file config `nextcloud/config/config.php`, to modify the value of `datadirectory`, as: `'datadirectory' => ((php_sapi_name() == 'cli') ? '/var/www' : '') . '/htdocs/data',` Of course, the `/htdocs/data` directory must correspond to your real case. Now, you can use without problem the `occ` command. After, dont forget to delete yours modifications before going to the web interface, otherwise you will not to be able to connect! ### TL;DR KiSS: * To "enable" occ: `sed -i -e 's#/htdocs#/var/www/htdocs#' nextcloud/config/config.php` * To "disable" occ: `sed -i -e 's#/var/www/htdocs#/htdocs#' nextcloud/config/config.php` ---- ## Acknowledgement I would liket to thank [@h3artbl33d](https://chargen.one/h3artbl33d/fixing-nextcloud-on-openbsd-with-a-chroot) who found this tips… ----