Have you inspected the logs in storage/logs/laravel.log for any errors? Yes
laravel.log last modfied on 3/8/2023 with production.ERROR: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 {“exception”:"[object] (ErrorException(code: 0): file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 at /home/host/public_html/website/client/app/Models/Presenters/CompanyPresenter.php:69)
[stacktrace]
invoiceninja.log appears normal is being written too.
Describe the bug
Steps To Reproduce
Open Client Portal, Click Invoice > Click View link > Website default 404 page appears
If I download from client portal by selecting the checkmark next to invoice, it downloads correctly.
I’m not sure, maybe this answer from ChatGPT will help:
Thanks for the detailed breakdown — you’re close to solving this. Based on your setup and the symptoms (404 when viewing invoice, but download works), this is most likely a misconfiguration related to APP_URL or the route handling behind the scenes, especially in a shared hosting environment with custom subdirectory deployment.
Here’s a breakdown and step-by-step guide to fix it:
Problem Summary
You’re on Invoice Ninja v5.11.61-C172, shared hosting (cPanel).
Invoices won’t display via the View Invoice link — gives a 404.
But downloading the invoice works — so data exists and permissions are okay.
The app is installed in /website/client/ and served via /website.com/client/public.
Root Cause (Most Likely)
The APP_URL is misconfigured for your deployment under a subdirectory.
You currently have:
APP_URL=“https://website.com/client/public”
But Laravel and Invoice Ninja expect APP_URL to not include /public in most cases, even if that’s how it’s served. This mismatch can break internal URL generation, especially for route-based views (like invoices/abc123/view).
Fix
Update .env file:
Replace this line:
APP_URL=“https://website.com/client/public”
With:
APP_URL=https://website.com/client
Clear config cache:
Run these (via SSH or through a scheduled job in cPanel if no CLI access):
The invoice should now render instead of showing 404.
Bonus Tip: allow_url_fopen
Your logs also show this:
file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0
This error doesn’t cause the 404 directly, but it’s used when generating things like the company logo for the PDF or client portal. If possible, enable this in your hosting’s php.ini:
allow_url_fopen = On
If you can’t change it globally, ask your host or try overriding with .user.ini or .htaccess (some hosts support it):
php_value allow_url_fopen On
Let me know how it goes — happy to help troubleshoot further if needed!