Can't save or send invoice: The client field is required

I installed Invoice Ninja 4.5.12 on an Uberspace 6 shared hosting using Per Guth’s instructions at

Everything went well, except I can’t save drafts of invoices or send them out. I get the error message “There was an error saving your invoice The client field is required.”

When I enable debugging in the settings, there is one exception:
The given data failed to pass validation.

I confirmed that the MySQL users database has is_admin = 1

The error remains both with and without the ‘attach PDF to email’ setting.

storage/logs/laravel-error log shows no new errors

What’s wrong? How can I fix this?

Do you have a valid client selected on the invoice?

I tried it by adding a client and choosing that one, and by creating one right in the form. Same result. Is there any field that absolutely needs to be there? I entered standard stuff like name, contact.

it could be a mod-security rule causing the issue. Are you able to temporarily disable modsecurity

Hm, I tried changing config/app.php’s APP_URL to a http:// url instead of https://.
And commented out these linesin .htaccess

  RewriteCond %{ENV:HTTPS} !=on
  RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

But for some reason I get a 302 redirect and always land on the https site, even in Icognito Chrome.

I also added

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off

to .htaccess but it didn’t help

I noticed that php prints a warning:

$ php -v
Failed loading /package/host/localhost/php-5.6.18/lib/php/extensions/no-debug-non-zts-20131226/  /package/host/localhost/php-5.6.18/lib/php/extensions/no-debug-non-zts-20131226/ undefined symbol: zend_opcode_handlers
PHP 7.0.33 (cli) (built: Dec 11 2018 17:04:18) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

Do you think that could cause a problem? I don’t see why PHP 7.0 would try to load a PHP 5 lib. But then I also don’t really know much about how PHP works :wink:

I found out that Apache’s error_log contains some info:

[Wed Apr 17 15:46:24 2019] [warn] [client XXXXXXXX] mod_fcgid: stderr: PHP Warning:  Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0, referer: https://SUBDOMAIN.DOMAIN/invoices/create
[Wed Apr 17 15:46:24 2019] [warn] [client XXXXXXXX] mod_fcgid: stderr: PHP Warning:  Unknown: POST data can't be buffered; all data discarded in Unknown on line 0, referer: https://SUBDOMAIN.DOMAIN/invoices/create

fcgid runs php with user permissions. (German Uberspace docs:

What is the temporary files directory? How can I change it to a location it has access to?

I uncommented the following line in my php.ini:
sys_temp_dir = "/tmp"

Now it seems to work!