Cannot Generate Report 504 Gateway Timeout

Hello all,

i have a problem generating a report for an encounter form.

When the “Download PDF” button is clicked, it delays for about 15sec and i get 504 Gateway Timeout.

I checked the PHP error logs and this was what i found.

2022/07/02 18:52:00 [error] 1125530#1125530: *99326 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xx.x.x, server: xxxxx.com, request: "POST /openemr/interface/patient_file/report/custom_report.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock", host: "xxxxx.com", referrer: "xxxxx.com/openemr/interface/patient_file/report/patient_report.php"

I also saw a bunch of these errors also in the logs. Maybe it might be of help.

2022/07/02 16:44:07 [error] 1125530#1125530: *99054 FastCGI sent in stderr: "PHP message: Request with site id '' contains invalid characters" while reading response header from upstream, client: xxxxx, server: xxxxxx, request: "POST /openemr/library/ajax/dated_reminders_counter.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "xxxxxx", referrer: "https://xxxxx.com/openemr/interface/main/tabs/main.php?token_main=358BYu97B7Mprcl7BY0IJj31Irxd27eEWKkLhx9Q"

Currently running OpenEMR v6.1.1 on Ubuntu.

Thanks in advance

Hello, Kofi.

It sounds like Apache isn’t happy with how long PHP is taking to reply to it. It’s tempting to tell you to just look at Apache’s gateway timeouts and extend them, but that probably won’t answer the root cause – encounter forms shouldn’t /be/ taking that long to run, so you may need to look farther afield for the real issue. Are there problems with memory usage, system load, database load, or free space on the drive?

1 Like

Hi @jesdynf,

Thanks for the response. There is no such insufficient resource problem. I’ll probe further and let you know what i find.

Thanks again

hi @kkappiah, have you compared the recommended php settings?

Hello @stephenwaite,

I checked the PhP recommended settings and the short_open_tag was commented out for Default, Production and Development. I uncommented the default and set it to off according to the PHP recommended settings and restarted nginx. I tried generating the report again and the same problem described above persists.