500 Error

Hi there,

I’ve installed the ZIP version of the self-hosted Invoice Ninja.

Environment is Apache / MySQL.

I followed the instructions here, and here. I skipped the first few steps of those Ubuntu / Apache instructions as I understood the ZIP version has all the necessary composer stuff included.

When I try to access https://invoicing.exampledomain.org, it successfully redirects to https://invoicing.exampledomain.org/setup and then I get a 500 error.

The error log shows:

[Wed Mar 14 10:48:28.150316 2018] [proxy_fcgi:error] [pid 97304:tid 140309719668480] [client 125.236.182.4:58522] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/opt/bitnami/apps/invoicing/htdocs/storage/logs/laravel-error.log" could not be opened: failed to open stream: Permission denied in /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php:14181\nStack trace:\n#0 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(14111): Monolog\Handler\StreamHandler->write(Array)\n#1 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13871): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13969): Monolog\Logger->addRecord(400, '***UnexpectedVa…', Array)\n#3 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13664): Monolog\Logger->error('***UnexpectedVa…', Array)\n#4 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13635): Illuminate\Log\Writer->writeLog('error', '***UnexpectedVa…', Array)\n#5 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled…\nPHP message: PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/opt/bitnami/apps/invoicing/htdocs/storage/logs/laravel-error.log" could not be opened: failed to open stream: Permission denied in /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php:14181\nStack trace:\n#0 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(14111): Monolog\Handler\StreamHandler->write(Array)\n#1 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13871): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13969): Monolog\Logger->addRecord(400, '***Symfony\\Comp…', Array)\n#3 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13664): Monolog\Logger->error('***Symfony\\Comp…', Array)\n#4 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compiled.php(13635): Illuminate\Log\Writer->writeLog('error', '***Symfony\\Comp…', Array)\n#5 /opt/bitnami/apps/invoicing/htdocs/bootstrap/cache/compi…\n'

Can anyone enlighten me as to what this is indicating?

Thank you very much.

My guess would be the storage folder doesn’t have the correct ownership/permissions.

https://stackoverflow.com/questions/30639174/file-permissions-for-laravel-5-and-others/37266353#37266353

Thanks Hillel.
Am I correct in thinking that the /path/to/your/laravel/root/directory in this case is the /public/ directory?

Or is it the top level ninja directory?

I am not familiar with Laraval at all.

Brilliant. It’s now loading! What a relief after hours of fluffing around with it.
Thank you very much.

Awesome, glad to hear it’s working!

For anyone else reading this, due to having similar permissions issues… Note that when issuing the following commands:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache1

Add public/logo to each of those. So you end up with…

sudo chgrp -R www-data storage bootstrap/cache public/logo
sudo chmod -R ug+rwx storage bootstrap/cache1 public/logo

Otherwise you’ll not be able to add a logo to your invoices.

1 Like

@inspirednz Thanks for posting this! I ran into this issue where a client could not view the invoice we generated and your post showed me exactly how to resolve the errant permissions issue.

It looks like 1 got added to the end of cache by accident, the commands to run from your invoiceninja root folder (eg: /var/www/invoiceninja) are:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
sudo chgrp -R www-data storage bootstrap/cache public/logo
sudo chmod -R ug+rwx storage bootstrap/cache public/logo
1 Like