500 — Server Error https://ninja.test/storage/J9wQ... Not Found

When I attempt to view an invoice or edit an invoice, we are getting 500 - Server Error messages.

storage/logs/laravel.log reports:
[2021-12-15 20:16:30] production.INFO: https://ninja.com/public/phantom/invoice/oONtpNo1DIjsRXbgSMEsFOFzDMcOD6JK?phantomjs_secret=secret
[2021-12-15 20:16:34] production.ERROR: file_get_contents(https://ninja.test/storage/J9wQGn0N8oUvE3dwqTfFRc9jzz1wwdmU/u7ZwyvkJLXmOW0jBifaT0Bf4dDd8T0EZYzqZfSq8.png): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
{“exception”:"[object] (ErrorException(code: 0): file_get_contents(https://ninja.test/storage/J9wQGn0N8oUvE3dwqTfFRc9jzz1wwdmU/u7ZwyvkJLXmOW0jBifaT0Bf4dDd8T0EZYzqZfSq8.png): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
at /home/ninja/public_html/app/Models/Presenters/CompanyPresenter.php:69)
[stacktrace]
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, ‘file_get_conten…’, ‘/home/ninja/…’, 69)
#1 /home/ninja/public_html/app/Models/Presenters/CompanyPresenter.php(69): file_get_contents(‘https://katybil…’, false, Resource id #1001)
#2

We are running on a cpanel based Centos box. This is a fresh Softaculous install.

Any ideas?

Hi,

@david any thoughts?

I can see the system attempting to get data from 3 different URLs there?

ninja.test

katybil…

David - thanks for looking at this for me, obscuring original domain bit me here. Let’s try this:
[2021-12-15 20:16:30] production.INFO: https://ninja.test/public/phantom/invoice/oONtpNo1DIjsRXbgSMEsFOFzDMcOD6JK?phantomjs_secret=secret
[2021-12-15 20:16:34] production.ERROR: file_get_contents(https://ninja.test/storage/J9wQGn0N8oUvE3dwqTfFRc9jzz1wwdmU/u7ZwyvkJLXmOW0jBifaT0Bf4dDd8T0EZYzqZfSq8.png): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
{“exception”:"[object] (ErrorException(code: 0): file_get_contents(https://ninja.test/storage/J9wQGn0N8oUvE3dwqTfFRc9jzz1wwdmU/u7ZwyvkJLXmOW0jBifaT0Bf4dDd8T0EZYzqZfSq8.png): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
at /home/ninja/public_html/app/Models/Presenters/CompanyPresenter.php:69)
[stacktrace]
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, ‘file_get_conten…’, ‘/home/ninja/…’, 69)
#1 /home/ninja/public_html/app/Models/Presenters/CompanyPresenter.php(69): file_get_contents(‘https://ninja…’, false, Resource id #1001)
#2 /home/ninja/public_html/app/Utils/HtmlEngine.php(375): App\Models\Presenters\CompanyPresenter->logo_base64(Object(stdClass))
#3 /home/ninja/public_html/app/Utils/HtmlEngine.php(509): App\Utils\HtmlEngine->buildEntityDataArray()

[2021-12-15 20:29:25] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Utils/Traits/AppSetup.php(31): App\Utils\SystemHealth::check()
#2 /home/ninja/public_html/app/Http/Controllers/BaseController.php(736): App\Http\Controllers\BaseController->checkAppSetup()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BaseController->flutterRoute()
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘flutterRoute’, Array)

[2021-12-15 20:35:18] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Http/Controllers/SetupController.php(50): App\Utils\SystemHealth::check(false)
#2 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\SetupController->index()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘index’, Array)
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\SetupController), ‘index’)

[2021-12-15 20:35:21] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Http/Controllers/SetupController.php(50): App\Utils\SystemHealth::check(false)
#2 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\SetupController->index()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘index’, Array)
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\SetupController), ‘index’)

[2021-12-15 21:09:10] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Utils/Traits/AppSetup.php(31): App\Utils\SystemHealth::check()
#2 /home/ninja/public_html/app/Http/Controllers/BaseController.php(736): App\Http\Controllers\BaseController->checkAppSetup()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BaseController->flutterRoute()
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘flutterRoute’, Array)

[2021-12-15 21:13:47] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Utils/Traits/AppSetup.php(31): App\Utils\SystemHealth::check()
#2 /home/ninja/public_html/app/Http/Controllers/BaseController.php(736): App\Http\Controllers\BaseController->checkAppSetup()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BaseController->flutterRoute()
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘flutterRoute’, Array)

[2021-12-15 21:15:45] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Utils/Traits/AppSetup.php(31): App\Utils\SystemHealth::check()
#2 /home/ninja/public_html/app/Http/Controllers/BaseController.php(736): App\Http\Controllers\BaseController->checkAppSetup()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BaseController->flutterRoute()
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘flutterRoute’, Array)

[2021-12-15 21:19:20] production.ERROR: Call to undefined function App\Utils\exec() {“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/ninja/public_html/app/Utils/SystemHealth.php:155)
[stacktrace]
#0 /home/ninja/public_html/app/Utils/SystemHealth.php(68): App\Utils\SystemHealth::checkPhpCli()
#1 /home/ninja/public_html/app/Utils/Traits/AppSetup.php(31): App\Utils\SystemHealth::check()
#2 /home/ninja/public_html/app/Http/Controllers/BaseController.php(736): App\Http\Controllers\BaseController->checkAppSetup()
#3 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BaseController->flutterRoute()
#4 /home/ninja/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘flutterRoute’, Array)

@katycomputer

So there looks to be a difference in the URLs, ie

https://ninja.test/public/phantom
https://ninja.test/storage/

This may be due to a rewrite rule or something that is cause the file to not be resolvable. You could either fix the rewrite so those URLs resolve correct, or you could hack around it by updating your .env file with

LOCAL_DOWNLOAD=true

Also I see some issues there. It looks like a PHP configuration on your system is attempting to run exec() from the namespace rather than the global PHP namespace, what version of PHP are you using?

I am running PHP 8.1, after changing .env to include LOCAL_DOWNLOAD=true, do I need to do anything beyond “php artisan optimize” to activate the change?

Thank you for your help

@katycomputer

That should be all that is required. One other change may be to down grade to PHP 8.0 to ensure it isn’t 8.1 that is causing this.

No joy on 8.0. I had things working on a HestiaCP server, when I realized I installed SQL as root, when I switch it to the user space, 500 errors took the place of a functioning IN 5 install.

Since then I have attempted install on several servers, next I will attempt installing on a fresh DirectAdmin server using Softaculous, if that fails, I am back to v4.5.46.

Thank you for your help!