Internal server error - Cant access loging page nextcloud

Hi everyone,

Im here to ask you cause i’m facing a problem that i didnt know to resolve. My nexcloud was fine some times ago, but know i didn know what’s going on, when i try to access my login page, i have a message "Internal server error etc … "

Nextcloud version 12.0.0.29_:
Operating system and version Centos 6.9:
Apache or nginx version Apache 2.2.15:
PHP version 5.6.31:

The last base that with i tried nexcloud at the begining was the default database sqllite, and when facing the problem i had make the conversion type to mysql by occ command.

Here the last line of my nexcloud.log

{“reqId”:“XTxIUZO5caKvnUq4AM4R”,“level”:3,“time”:“2017-08-09T07:07:59+00:00”,“remoteAddr”:“154.126.97.48”,“user”:“–”,“app”:“index”,“method”:“GET”,“url”:“/nextcloud/index.php/apps/theming/logo?v=13”,“message”:“Exception: {"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing ‘CREATE table oc_locks_w2g(name varchar(255) PRIMARY KEY,created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,locked_by varchar(255))’:\n\nSQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes","Code":0,"Trace":"#0 \/var\/www\/html\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(128): Doctrine\\DBAL\\Driver\\AbstractMySQLDriver->convertException(‘An exception oc…’, Object(Doctrine\\DBAL\\Driver\\PDOException))\n#1 \/var\/www\/html\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Statement.php(178): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException), ‘CREATE table oc…’, Array)\n#2 \/var\/www\/html\/nextcloud\/lib\/private\/legacy\/db\/statementwrapper.php(72): Doctrine\\DBAL\\Statement->execute()\n#3 \/var\/www\/html\/nextcloud\/apps\/workin2gether\/appinfo\/app.php(34): OC_DB_StatementWrapper->execute()\n#4 \/var\/www\/html\/nextcloud\/lib\/private\/legacy\/app.php(209): require_once(‘\/var\/www\/html\/n…’)\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/legacy\/app.php(149): OC_App::requireAppFile(‘workin2gether’)\n#6 \/var\/www\/html\/nextcloud\/lib\/private\/legacy\/app.php(124): OC_App::loadApp(‘workin2gether’)\n#7 \/var\/www\/html\/nextcloud\/lib\/base.php(997): OC_App::loadApps()\n#8 \/var\/www\/html\/nextcloud\/index.php(40): OC::handleRequest()\n#9 {main}","File":"\/var\/www\/html\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php","Line":116}”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0”,“version”:“12.0.0.29”}

And the config.php is

<?php
$CONFIG = array (
  'instanceid' => 'xxxxx',
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxxxQ',
  'trusted_domains' =>
  array (
    0 => 'xxxxx',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'overwrite.cli.url' => 'http://xxxxx/nextcloud',
  'dbtype' => 'mysql',
  'version' => '12.0.0.29',
  'installed' => true,
  'maintenance' => false,
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbuser' => 'root',
  'dbpassword' => xxxxx',
);

Here is the ouput error of my apache

[Wed Aug 09 09:51:54 2017] [error] [client 154.126.97.48] PHP Warning: fileperms(): stat failed for /var/www/html/nextcloud/data/nextcloud.log in /var/www/html/nextcloud/lib/private/Log/File.php on line 122
[Wed Aug 09 09:51:54 2017] [error] [client 154.126.97.48] {“reqId”:“t1DQD2kuw6ZKKRLEwNrx”,“level”:3,“time”:“2017-08-09T07:51:54+00:00”,“remoteAddr”:“154.126.97.48”,“user”:“–”,“app”:“PHP”,“method”:“GET”,“url”:“\/nextcloud\/”,“message”:“fileperms(): stat failed for \/var\/www\/html\/nextcloud\/data\/nextcloud.log at \/var\/www\/html\/nextcloud\/lib\/private\/Log\/File.php#122”,“userAgent”:“Mozilla\/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko\/20100101 Firefox\/54.0”,“version”:“”}
[Wed Aug 09 09:51:54 2017] [error] [client 154.126.97.48] {“reqId”:“t1DQD2kuw6ZKKRLEwNrx”,“level”:3,“time”:“2017-08-09T07:51:54+00:00”,“remoteAddr”:“154.126.97.48”,“user”:“–”,“app”:“PHP”,“method”:“GET”,“url”:“\/nextcloud\/”,“message”:“chmod(): Permission denied at \/var\/www\/html\/nextcloud\/lib\/private\/Log\/File.php#123”,“userAgent”:“Mozilla\/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko\/20100101 Firefox\/54.0”,“version”:“”}

Thanks for your help.

1 Like

Please don’t post your config.php without removing your private information like passwordsalt, secret, db password and so on! Treat this information as compromised and consider changing your credentials.

Hi,

could you check the permissions for files and folders in /var/www/html/nextcloud ?
Please make sure everything has read/write permissions for the apache user www-data

You can run the following commands:

chown -R www-data:www-data /var/www/html/nextcloud
find /var/www/html/nextcloud -type d -print0 | xargs -0 chmod 750
find /var/www/html/nextcloud -type f -print0 | xargs -0 chmod 640

Did you remove apps or modifications (theming, logo files or anything) before an upgrade or something like that? I once pasted a logo file into a subfolder of Nextcloud. And while I had to remove it before the NC upgrade I had an “internal server error” after the upgrade before I copied the logo file back in again.

1 Like

Thanks for answering me.

Before the NC upgrade i have done changing the logo and the theme of the
application.

like im in centos my apache user-group is “apache:apache” so i had execute
the command that you have enter above but it didn’t change anything the
problem still persist.

Here is my log file :

{“reqId”:“pgQJONnk7d0lFq7EObcq”,“level”:3,“time”:“2017-08-09T14:06:45+00:00”,“remoteAddr”:“197.158.74.51”,“user”:"–",“app”:“index”,“method”:“GET”,“url”:"/nextcloud/index.php/apps/theming/logo?v=13",“message”:“Exception:
{“Exception”:“Doctrine\\DBAL\\Exception\\DriverException”,“Message”:“An
exception occurred while executing ‘CREATE table oc_locks_w2g(name
varchar(255) PRIMARY KEY,created TIMESTAMP DEFAULT
CURRENT_TIMESTAMP,locked_by varchar(255))’:\n\nSQLSTATE[42000]: Syntax
error or access violation: 1071 Specified key was too long; max key length
is 767 bytes”,“Code”:0,“Trace”:”#0
\/var\/www\/html\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(128):
Doctrine\\DBAL\\Driver\\AbstractMySQLDriver->convertException(‘An
exception oc…’, Object(Doctrine\\DBAL\\Driver\\PDOException))\n#1
\/var\/www\/html\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Statement.php(178):
Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver),
Object(Doctrine\\DBAL\\Driver\\PDOException), ‘CREATE table oc…’,
Array)\n#2
\/var\/www\/html\/nextcloud\/lib\/private\/legacy\/db\/statementwrapper.php(72):
Doctrine\\DBAL\\Statement->execute()\n#3
\/var\/www\/html\/nextcloud\/apps\/workin2gether\/appinfo\/app.php(34):
OC_DB_StatementWrapper->execute()\n#4
\/var\/www\/html\/nextcloud\/lib\/private\/legacy\/app.php(209):
require_once(’\/var\/www\/html\/n…’)\n#5
\/var\/www\/html\/nextcloud\/lib\/private\/legacy\/app.php(149):
OC_App::requireAppFile(‘workin2gether’)\n#6
\/var\/www\/html\/nextcloud\/lib\/private\/legacy\/app.php(124):
OC_App::loadApp(‘workin2gether’)\n#7
\/var\/www\/html\/nextcloud\/lib\/base.php(997):
OC_App::loadApps()\n#8
\/var\/www\/html\/nextcloud\/index.php(40):
OC::handleRequest()\n#9
{main}",“File”:"\/var\/www\/html\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php",“Line”:116}",“userAgent”:“Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/60.0.3112.90 Safari/537.36”,“version”:“12.0.0.29”}

Have you other ideas for helping me ?

Thanks

Well, I’m not a developer, so pretty difficult for me, too.
I believe there is more than one problem. The first was solved by changing the permission. That message doesn’t appear in the logs again.

The other problem is the DB problem caused by the App “Working 2gether” (or Working Together):

“An exception occurred while executing ‘CREATE table oc_locks_w2g(name varchar(255) PRIMARY KEY,created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,locked_by varchar(255))’:\n\nSQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes”,“Code”:0,“Trace”:”#0

With a very quick research on the net there was some statement that the DB column could be tweaked, but that would be a task for the developer of the Working 2gether App. And while this comes from that App I’m not sure if disabling and removing the app could help.

The other way is to change settings of the DB:

I hope this helps somehow.

I have solved the problem by removing the app working2together, it seems
that it is not stable for the actual version of nextcloud.

Thanks you very much for the help Schmu.