PDF issue - throws 500 error (Arch Linux)

Invoice Ninja: v5.1.8
PHP version: v8.0.2

I appreciate that Arch is not a “supported” distro but it makes for a brilliant OS on a VPS as it is small, quick and, being a rolling release OS, never requires a re-build of the VPS every time there is a major new OS update (like Ubuntu, CentOS etc). My company is moving all our servers to Arch for this reason and because we all use Arch on our desktops in the office. InvoiceNinja is the only Laravelle app I’m struggling to migrate.

Once I get this working I propose to create a package and submit it to Arch AUR (the current one is way out of date and doesn’t work). So all help to get this resolved gratefully received!

I have a working version of 4.5.3 on our Ubuntu VPS but it is being decommissioned within the next 4 weeks so I’m on the clock :wink:

I’ve installed 5.1.8 on the Arch server and have successfully migrated from our v4 server without any apparent errors. But PDF generation refuses to work - the setup was OK and the test PDF produced, and I’ve manually run snappdf from the app folder and generated a PDF of “Hello World” but inside the app when trying to either create and invoice or create a new invoice style I get 500 server errors with

production.ERROR: Required parameter $field follows optional parameter $custom_fields {“userId”:1,“exception”:"[object] (ErrorException(code: 0): Required parameter $field follows optional parameter $custom_fields at /srv/http/hosts/invoiceninja/app/Utils/Helpers.php:52)

as the error message.

As a check, I dropped all the tables and rebuilt them using artisan. I then used the dummy company (without migrating our live data) to rule out something being wonky with the migration process. Same result and error message.

Any ideas what I can try to get this to work? I’d prefer not to downgrade PHP as v8 is required for another app.

TIA

Hey there, thanks for submitting this.

I appreciate that Arch is not a “supported” distro but it makes for a brilliant.

Can you please reference, where you read this? As far as I know, Arch should be supported just fine, no reason not to.

Next, if the PDF generation works from the command line, that’s good. Looks like there’s a bug in our app, regarding php80.

At the moment php80 isn’t supported (one of our main dependencies isn’t up-to-date). I know this really sucks, but that’s what we have to deal with at the moment.

Until we get up & going with php80, I suggest you install version 5 using Docker. Thanks.

Thanks for responding Ben.

I put “supported” in quotes because I’d not seen anything official either way but every self-host tutorial I’ve come across has been for CentOS or Debian/Ubuntu. I’m keen to help support and promote Arch as Invoice Ninja was the easiest install I’ve done to date - all I needed to add was the php-gd package to get everything up and running.

I’ve not used Docker before so I’ll look at that. Also, as a fallback, is it possible to tell Invoice Ninja to use a specific version of PHP if I installed 7.4 alongside 8.0?

With respect to PHP8, feel free to ask me to test stuff as I’ll keep the existing setup on the server

Feel free to put some guide on installing Invoice Ninja on the forum & we’ll gladly list it in our docs! (you can pull request the update yourself, also).

Install guides written for CentOS & Ubuntu are community-created, so Arch would be accepted open-handed!

You can install multiple PHPs. I’ve used Arch myself, php74 or other (from AUR) will land into /usr/local/bin/php74 or /usr/bin/php74. All you have to do is tell Nginx to use that php-fpm & I think that should be more or less it.

@david might have some advice, he’s our devops expert here. Thanks!

As @ben mentioned, it is possible to setup multiple different PHP runtimes and then target which ever you need.

We are waiting for one package to include PHP 8 support and then we can also include that in the supported list of runtimes.

@ben @david thanks for the replies. PHP7.4 installed and running. Very easy and I’ll write it up once I’ve got everything working (keeping notes… :wink:)

Invoice previews when designing invoices in Settings works but I can’t view live invoices I’ve created. Still throwing a 500 error with the following error in Laravel logs

production.ERROR: Impossible to create the root directory “/srv/http/hosts/invoiceninja/public/storage/exqztgixf9qvhokdwkebcsjk9c46qoql/6GOgiPo2jrFwda6V5B5UVNmnfzolR4WlGvFMWUqx/invoices”. {“exception”:"[object] (League\Flysystem\Exception(code: 0): Impossible to create the root directory “/srv/http/hosts/invoiceninja/public/storage/exqztgixf9qvhokdwkebcsjk9c46qoql/6GOgiPo2jrFwda6V5B5UVNmnfzolR4WlGvFMWUqx/invoices”. at /srv/http/hosts/invoiceninja/vendor/league/flysystem/src/Adapter/Local.php:112)

This is working on migrated data from v4 - the 1st part of the folder structure after the /storage/ is the “identifier” that was assigned to my company (ie the name of the uploaded logo) in v4

I’ve even created these folders manually and I still get this error. Permissions and ownership are correct as far as I can tell (I went 777 to be certain and owner is http:http which is Apache2 on Arch)

Any ideas?

@ben @david

Cancel the above - I was looking at the wrong folder structure /invoiceninja/storage rather than /invoiceninja/public/storage

But here’s the thing - the exqztgixf9qvhokdwkebcsjk9c46qoql folder was root:root rather than http:http. How come? I just did the migration but I didn’t check or change the ownership afterwards and I didn’t create this folder.

HTH

777 should never been used. @david can you help?

@ben that was just me debugging. But I was in the wrong place anyways!

@ben @david I think I’ve found it - the cronjob for the scheduler was setup for root not http so the file/folder permissions were changing when IN was trying to do anything with invoices (as opposed to designing the invoice). Hope I’m right as I’ve been tearing my hair out for most of today!

Are you running your crons under the http user?

Yes, I am now, but they don’t seem to be working. I’ll check this out tomorrow and revert back. It’s 8pm here in the UK so I’m calling it a day

1 Like

Arch user guide posted. Hope it’s OK.

2 Likes

Awesome, great job! It’s part of official docs now! :star2:

1 Like