500 Server Error after install

I am trying to get Invoice Ninja V5.3.84 self hosted from Softaculous installation to work.

When I try to run the script it stops me and I can not get a full login screen
Image of what I get

If I click the link under the 500 server error - it takes me to domain/client - which is not found error. If I modify the url to domain/ninjadirectory/public/client - it shows the client login screen.

I am thinking there are some serious url issues that might be stopping for the pages to load correctly.

I have looked at the .env file and it shows correct url info

I checked the error log and found this for when I tried to run domain/ninjadirectory

[Wed May 04 17:49:48.016606 2022] [autoindex:error] Cannot serve directory /home/xprivate/public_html/ninjadirectory/public/vendor/: No matching DirectoryIndex (index.php,index.php5,index.php4,index.php3,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.phtml,index.shtml,index.xhtml,index.html,index.htm,index.wml,Default.html,Default.htm,default.html,default.htm,home.html,home.htm) found, and server-generated directory index forbidden by Options directive

Should also mention that I am using PHP8 - I know that PHP8 did not work for V4 - I had to temporarily bump down to PHP7.4 on my other account to keep v4 working. But hosting will require php8 so I need this to work :slight_smile:

Hi,

@david do you have any thoughts on the error?

This is an Apache configuration issue

[Wed May 04 17:49:48.016606 2022] [autoindex:error] Cannot serve directory /home/xprivate/public_html/ninjadirectory/public/vendor/: No matching DirectoryIndex (index.php,index.php5,index.php4,index.php3,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.phtml,index.shtml,index.xhtml,index.html,index.htm,index.wml,Default.html,Default.htm,default.html,default.htm,home.html,home.htm) found, and server-generated directory index forbidden by Options directive

It looks like your full path is to the vendor folder?

it should be

/home/xprivate/public_html/ninjadirectory/public/

Why would the script be looking for vendor directory instead of just public?

the .env file says the app_URL is the public directory.

Maybe there is something wrong with the index file?

define(‘LARAVEL_START’, microtime(true));
require DIR.’/…/vendor/autoload.php’;
$app = require_once DIR.’/…/bootstrap/app.php’;

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);

This is what the .env file shows:
image

@krickman

What is the directory index configured in the virtual host of apache

UPDATE:

Hosting company is messing with PHP settings and extensions to see why Invoice Ninja is not operating correctly. After messing with settings and extensions - PHP 7.4 will run invoice ninja correctly. But they are still trying to figure out PHP 8.0.

Is there a list of required PHP settings and extensions for PHP 8.0 needed to run Invoice Ninja v5?

Sorry setting up servers is not my thing :slight_smile:

Have you seen this list here:

https://invoiceninja.github.io/docs/self-host-installation/#server-requirements

Are you seeing any specific errors?

No I had not seen that - thank you, I will share it with the hosting company. :slight_smile:

The issue turned out to be exec() setting. For security reasons on some shared hosting accounts they don’t like this bein enabled.

The hosting company shared this with me, and I hope it helps Invoice Ninja to possibly work on this so that it is not an issue with some servers who are wanting to keep tight security.

---- hosting felt this
Note that the exec() function is also disabled in PHP 7.4 and PHP 7.3 on our servers. And Invoice Ninja was working in these environments.

The issue comes from PHP 8.0 changing the way exceptions are thrown for these disabled functions. Prior to PHP 8.0, PHP would throw an exception if a call to a disabled function was made. Invoice Ninja is programmed correctly to catch these exceptions and proceed on.

But with PHP 8.0, these disabled functions aren’t throwing an exception - they are just causing a fatal error - which stops all processing of the script. That’s what was creating the Internal Server errors.

Thanks for sharing this!

cc @david

@krickman

We only use exec() to check the PHP cli version so the application should still work fine

If you can advise what functions have been disabled on the server perhaps we can work backwards to see exactly where the issue is.

I have sent in a request to get that info. It might be a day or so before I get it. Thanks for helping.

did this issue ever come to a conclusion?

I’m having this issue on PHP 8 / WinServer 2022. Anyone got a solution?
I don’t see exec() being disabled anywhere in php.ini, and any of the manuals to enable exec() don’t work for PHP 8.

I managed to get past the HTTP 500 error, had a look at the logs, installed v5.5.104-SC113

[31-Jan-2024 16:00:03 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 528384 bytes) in /home/username/

I just updated my PHP 8.1 ini settings as per the following screenshot:

Hope it helps.