[Solved] Nextcloud 15.0.0 Internal Server Error after install


#1

Hello Nextclouders!

I’m really excited about Nextcloud and for the last few days I’ve been trying to do a manual install of nextcloud 15 (though this same issue comes up when I try different versions) on my home server computer (mint box running Linux Mint 17.2 Rafaela).

I intend to use the Talk application the most, and I also plan on doing a lot cloud collaboration with my clients. I wanted to do a manual install (instead of a snap install) because it seems like the best way to go for both performance purposes and installing additional apps and their dependencies.

I have gotten fairly far in the installation process and now I am stuck.

When I go to http://localhost/nextcloud

I see this message:

“Internal Server Error
The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.”

I did some searching and saw that people were finding a log in /var/www/nextcloud/data/ but this directory does not exist on my system which was my first problem.

After some digging I found /var/log/apache2/error.log
and it seems to indicate that it lacks permissions to make nextcloud/data/files

Any help with how I can proceed would be greatly appreciated.

Here’s What I’m Running:

Distributor ID:	LinuxMint
Description:	Linux Mint 17.2 Rafaela
Release:	17.2
Codename:	rafaela

/var/log/apache2/error.log:

> [Mon Jan 07 16:48:31.056971 2019] [mpm_prefork:notice] [pid 14798] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
> 
> [Mon Jan 07 16:48:31.057065 2019] [core:notice] [pid 14798] AH00094: Command line: '/usr/sbin/apache2'
> 
> [Mon Jan 07 16:49:09.410443 2019] [php7:warn] [pid 14801] [client ::1:53530] PHP Warning:  fileperms(): stat failed for /var/www/nextcloud/data/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.410486 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"touch(): Unable to create file \\/var\\/www\\/nextcloud\\/config\\/config.php because Permission denied at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Config.php#240","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.410582 2019] [php7:warn] [pid 14801] [client ::1:53530] PHP Warning:  fileperms(): stat failed for /var/www/nextcloud/data/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.410595 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"fopen(\\/var\\/www\\/nextcloud\\/config\\/config.php): failed to open stream: No such file or directory at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Config.php#241","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.410671 2019] [php7:warn] [pid 14801] [client ::1:53530] PHP Warning:  fileperms(): stat failed for /var/www/nextcloud/data/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.410683 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"chmod(): No such file or directory at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Config.php#244","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.440092 2019] [php7:warn] [pid 14801] [client ::1:53530] PHP Warning:  fileperms(): stat failed for /var/www/nextcloud/data/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.440118 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"fileperms(): stat failed for \\/var\\/www\\/nextcloud\\/data\\/nextcloud.log at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Log\\/File.php#140","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.440135 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"index","method":"GET","url":"\\/nextcloud\\/index.php","message":{"Exception":"OC\\\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Config.php","line":132,"function":"writeData","class":"OC\\\\Config","type":"->","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/SystemConfig.php","line":100,"function":"setValue","class":"OC\\\\Config","type":"->","args":["instanceid","ocsr0bht7bta"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/legacy\\/util.php","line":1143,"function":"setValue","class":"OC\\\\SystemConfig","type":"->","args":["instanceid","ocsr0bht7bta"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/base.php","line":415,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/base.php","line":656,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/index.php","line":40,"args":["\\/var\\/www\\/nextcloud\\/lib\\/base.php"],"function":"require_once"}],"File":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Config.php","Line":251,"Hint":"This can usually be fixed by giving the webserver write access to the config directory. See https:\\/\\/docs.nextcloud.com\\/server\\/14\\/go.php?to=admin-dir_permissions","CustomMessage":"--"},"userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.440437 2019] [php7:warn] [pid 14801] [client ::1:53530] PHP Warning:  fileperms(): stat failed for /var/www/nextcloud/data/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.440449 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"fileperms(): stat failed for \\/var\\/www\\/nextcloud\\/data\\/nextcloud.log at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Log\\/File.php#140","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.440463 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"index","method":"GET","url":"\\/nextcloud\\/index.php","message":{"Exception":"Doctrine\\\\DBAL\\\\DBALException","Message":"Failed to connect to the database: An exception occured in driver: could not find driver","Code":0,"Trace":[{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/Connection.php","line":992,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/DB\\/Connection.php","line":216,"function":"executeUpdate","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":["PRAGMA read_uncommitted = 1",[],[]]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/Connection.php","line":623,"function":"executeUpdate","class":"OC\\\\DB\\\\Connection","type":"->","args":["PRAGMA read_uncommitted = 1"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/DB\\/Connection.php","line":151,"function":"setTransactionIsolation","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":[2]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/DriverManager.php","line":172,"function":"__construct","class":"OC\\\\DB\\\\Connection","type":"->","args":[{"adapter":"OC\\\\DB\\\\AdapterSqlite","driver":"pdo_sqlite","wrapperClass":"OC\\\\DB\\\\Connection","user":"","password":"","path":"\\/var\\/www\\/nextcloud\\/data\\/owncloud.db","tablePrefix":"oc_","sqlite.journal_mode":"WAL","defaultTableOptions":{"collate":"utf8_bin","tablePrefix":"oc_"},"platform":{"__class__":"OC\\\\DB\\\\OCSqlitePlatform"}},{"__class__":"Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver"},{"__class__":"Doctrine\\\\DBAL\\\\Configuration"},{"__class__":"Doctrine\\\\Common\\\\EventManager"}]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/DB\\/ConnectionFactory.php","line":158,"function":"getConnection","class":"Doctrine\\\\DBAL\\\\DriverManager","type":"::","args":[{"adapter":"OC\\\\DB\\\\AdapterSqlite","driver":"pdo_sqlite","wrapperClass":"OC\\\\DB\\\\Connection","user":"","password":"","path":"\\/var\\/www\\/nextcloud\\/data\\/owncloud.db","tablePrefix":"oc_","sqlite.journal_mode":"WAL","defaultTableOptions":{"collate":"utf8_bin","tablePrefix":"oc_"},"platform":{"__class__":"OC\\\\DB\\\\OCSqlitePlatform"}},{"__class__":"Doctrine\\\\DBAL\\\\Configuration"},{"__class__":"Doctrine\\\\Common\\\\EventManager"}]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":640,"function":"getConnection","class":"OC\\\\DB\\\\ConnectionFactory","type":"->","args":["sqlite",{"user":"","password":"","path":"\\/var\\/www\\/nextcloud\\/data\\/owncloud.db","tablePrefix":"oc_","sqlite.journal_mode":"WAL","defaultTableOptions":{"collate":"utf8_bin","tablePrefix":"oc_"},"platform":{"__class__":"OC\\\\DB\\\\OCSqlitePlatform"}}]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OCP\\\\IDBConnection"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["OCP\\\\IDBConnection"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":165,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OCP\\\\IDBConnection"]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":114,"function":"OC\\\\AppFramework\\\\Utility\\\\{closure}","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["DatabaseConnection"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["DatabaseConnection"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":1551,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["DatabaseConnection"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":455,"function":"getDatabaseConnection","class":"OC\\\\Server","type":"->","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\AppConfig"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["OC\\\\AppConfig"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":694,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\AppConfig"]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":165,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":114,"function":"OC\\\\AppFramework\\\\Utility\\\\{closure}","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["AppManager"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["AppManager"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":1722,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["AppManager"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/legacy\\/template.php","line":312,"function":"getAppManager","class":"OC\\\\Server","type":"->","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/index.php","line":51,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory. See https:\\/\\/docs.nextcloud.com\\/server\\/14\\/go.php?to=admin-dir_permissions",503]}],"File":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/DB\\/Connection.php","Line":64,"CustomMessage":"--"},"userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.450748 2019] [php7:warn] [pid 14801] [client ::1:53530] PHP Warning:  fileperms(): stat failed for /var/www/nextcloud/data/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.450778 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"fileperms(): stat failed for \\/var\\/www\\/nextcloud\\/data\\/nextcloud.log at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Log\\/File.php#140","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/
> 
> [Mon Jan 07 16:49:09.450802 2019] [php7:notice] [pid 14801] [client ::1:53530] {"reqId":"TXSCpadjEWOysuS4kBo5","level":3,"time":"2019-01-08T01:49:09+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"GET","url":"\\/nextcloud\\/index.php","message":"chmod(): No such file or directory at \\/var\\/www\\/nextcloud\\/lib\\/private\\/Log\\/File.php#141","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/71.0.3578.98 Safari\\/537.36","version":""}, referer: http://localhost/nextcloud/

#2

I’m guessing your file permissions are incorrect. Whatever you’ve set your apache2 runtime user to be, that user needs access to the files in that folder.

The short (and insecure) answer is that doing a sudo chmod -R ugo+rw * in your /var/www/nextcloud directory will probably make things “work”.

The correct answer is to read this explanation of file permissions and configure your apache2 and directories accordingly.


#3

This did the trick. Much appreciated!
I suppose the long answer would involve finding the specific files within the nextcloud directory and doing this for them individually?


#4

See no.10 here:
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/manual_upgrade.html