500 Internal server error [After installation running fine for +5 days]

We installed the software on our server to test it and it ran fine for several days without any issues. We did not do anything special inside and configured it etc. So the installation was pretty much vanilla. So no real changes has been made.

But now yesterday when I went back to start configure Invoice Ninja it is suddenly displaying the 500 error:


We have enabled debug mode [APP_DEBUG=true), but that doesn’t seem to do much of a help as the server only responds with 500 all the time. The only log file we can find is the laravel.log, but no specific error log or debug log etc.

We have given the installation 512 MB of memory so it should be sufficient. DB is MariaDB and apache web server.
File Permission changes:
env. 600, .htacess 404 (tested with 600 after the 500 error, no change)

Here is the laravel.log uploaded to G drive:
https://shorturl.gg/error-log

When viewing the laravel.log file this one file seem to constantly be reported by invoiceNinja as a part of the issue:
/bootstrap/cache/routes-v7.php

At this point I don’t have any idea how to get rid of the 500 error and I would appreciate very much any help that would lead in the direction to be able to solve this. :smirk: :+1:

Thanks in advance! :smiley:

Kind regards
AngryWarrior

Hi,

@david any thoughts?

AngryWarrior,

can you try changing to PHP8 please.

We will install PHP 8 on the server and test if that makes the trick.

I will get back with a status how it went after that.

By the way; what is the actual recommended memory requirement for InvoiceNinja? Haven’t found anything/document that mention this.

Thanks again.
Kind regards
AngryWarrior

Hmm it seems that our server is using Centos 6 so it is isn’t compatible with PHP 8 which just has been released. It is running PHP 7.4 right now which seems to be the highest compatible version.

Kind regards
AngryWarrior

@david or @hillel could you guys please answer that question, plus the below one?

  • Also is PHP version is minimum required?
    (PHP 8 was released just a few days ago in may 2021 so it cannot be that one, right?)

Kind regards
AngryWarrior

Is SELINUX enabled on this box?

Memory limit really can be variable depending on the size of your dataset, if you have thousands of records, i would recommend ~ 512mb more if you have 10’s of thousands of records.

In regards to PHP, if you are managing the server yourself, 7.3 should be fine… I think the issue you are seeing is related to SELINUX.

I had a similar problem 500 Server Error recently on a php7.3 version of V5 I was getting

In routes-v7.php line 22089: syntax error, unexpected ‘)’, expecting end of file

showing up. In the end I found out that for some reason there were extra

)

);

showing on the end of the routes-v7.php which I deleted ( I think it was the last 2 lines) and then all started working fine.

I’ve no idea why these extra lines appeared.

Hi.
I disabled it as per recommendation in the documents.

Kind regards
AngryWarrior

Hi @n03lm
thanks for sharing this. i did remove the two first ones at line 22092 - 22091 but nothing happened. Still 500. Next line 22089 contains ), removing that makes the server memory flooded and the server runs out of memory. closing the code line with ); with pretty much the same result.

Kind regards
AngryWarrior

Well at least now the debugger suddenly started to work:

Exception:
ParseError
in /home/public_htmlbootstrap/cache/routes-v7.php (line 22089)
‘waitSeconds’ => NULL, ), ),)); ),));
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Application.php → Illuminate\Foundation\Support\Providers{closure} (line 955)
* @return void / protected function fireAppCallbacks(array $callbacks) { foreach ($callbacks as $callback) { $callback($this); } } /* * {@inheritdoc}
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Application.php → fireAppCallbacks (line 900)
$this->bootProvider($p); }); $this->booted = true; $this->fireAppCallbacks($this->bootedCallbacks); } /** * Boot the given service provider. *
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php → boot (line 17)
* @param \Illuminate\Contracts\Foundation\Application $app * @return void / public function bootstrap(Application $app) { $app->boot(); }}
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Application.php → bootstrap (line 237)
$this->hasBeenBootstrapped = true; foreach ($bootstrappers as $bootstrapper) { $this[‘events’]->dispatch('bootstrapping: '.$bootstrapper, [$this]); $this->make($bootstrapper)->bootstrap($this); $this[‘events’]->dispatch('bootstrapped: '.$bootstrapper, [$this]); } }
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php → bootstrapWith (line 152)
* @return void / public function bootstrap() { if (! $this->app->hasBeenBootstrapped()) { $this->app->bootstrapWith($this->bootstrappers()); } } /
* Get the route dispatcher callback.
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php → bootstrap (line 136)
{ $this->app->instance(‘request’, $request); Facade::clearResolvedInstance(‘request’); $this->bootstrap(); return (new Pipeline($this->app)) ->send($request) ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) ->then($this->dispatchToRouter());
in /home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php → sendRequestThroughRouter (line 110)
public function handle($request) { try { $request->enableHttpMethodParameterOverride(); $response = $this->sendRequestThroughRouter($request); } catch (Throwable $e) { $this->reportException($e); $response = $this->renderException($request, $e); }
Kernel->handle(object(Request))
in /home/public_htmlpublic/index.php (line 57)
*/$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);$response = $kernel->handle( $request = Illuminate\Http\Request::capture());$response->send();

Stacktrace:

ParseError
ParseError:
syntax error, unexpected ')', expecting end of file

  at /home/public_htmlbootstrap/cache/routes-v7.php:22089
  at Illuminate\Foundation\Support\Providers\RouteServiceProvider->Illuminate\Foundation\Support\Providers\{closure}(object(Application))
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Application.php:955)
  at Illuminate\Foundation\Application->fireAppCallbacks(array(object(Closure), object(Closure), object(Closure)))
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Application.php:900)
  at Illuminate\Foundation\Application->boot()
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17)
  at Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(object(Application))
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Application.php:237)
  at Illuminate\Foundation\Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders'))
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:152)
  at Illuminate\Foundation\Http\Kernel->bootstrap()
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:136)
  at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request))
     (/home/public_htmlvendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:110)
  at Illuminate\Foundation\Http\Kernel->handle(object(Request))
     (/home/public_htmlpublic/index.php:57)

Kind regards
AngryWarrior

Hi @david
Any comments on the above debug report please? :thinking:

Thanks in advance. :smirk:

Kind regards
AngryWarrior

Not sure what has happened there to be honest.

I’d delete all the files in bootstrap cache and see what happens.

Ok, thank you @david . :+1:

I’ll wait for a status then of what you find out.

Kind regards
AngryWarrior.

Oh… Hang on…
Did you mean that I should delete all the files in the folder ‘cache’?

So it is really a dynamic cache folder where files can be deleted?

Thanks again…

Kind regards
AngryWarrior.

@AngryWarrior

Correct, the bootstrap/cache files can be deleted - the system will regenerate them.

2 Likes

Hi David. :smiley:

Ok great, I will try that and pray it will solve the issue. :pray:
Thank you for clarifying that.

I’ll get back with status of if it worked for me or not.

Kind regards
AngryWarrior.

Hi David.
Well that didn’t work.

I deleted the cache and ever restarted the server to make sure that the change was read.

Once I hit the enter key on my keyboard for the URL the browser just waits forever. Meanwhile on the server the script overflood the memory causing other websites and business applications to crash. Only option left is to restart the server again to get things up and running properly.

I did find the log is full of new error messages of another kind than the last time. I’ve uploaded it to Google Drive again:
https://shorturl.gg/h3FCB3h

Kind regards
AngryWarrior.

@AngryWarrior

Can you advise which version of PHP you are using?

Hi David.
The current version is PHP 7.4.

Kind regards
AngryWarrior.