Weird problem with Apache and php
galtsev at kicp.uchicago.edu
Wed Jun 9 20:35:21 UTC 2021
On 6/9/21 2:48 PM, Niels Kobschätzki wrote:
> I have a weird problem on an old machine (FBSD 11.2, Apache 2.4, php 7.1 - please don’t ask): I am trying to upload files via a simple php-script. I am using mod_proxy_fcgi for connecting Apache to php-fpm. When I try to upload a file of a size between 63 and 64 KByte it works fine. As soon as the file is 1 Byte bigger the following happens:
> The upload starts and I see the temporary file popping up in /tmp and it is at max ca 40KByte in size. Interestingly it was today a different size in Bytes then with my tests yesterday but it is over the day always the exact same size. Then php hangs and suddenly php-fpm disconnects and errors out and the browser shows that something went wrong - maybe the server is busy, but no error code. That suddenly is always around 18 seconds and it is also always the same time.
> I attached truss to the php-fpm-process that handles the upload and you see it start, then nothing happens and php-fpm releases the connection. I did a tcpdump on the loopback-interface on port 9000 and you see that the upload starts and suddenly there is an error uploading the file-message in the dump.
> I checked the post_max_size and the upload_max_size, they are at over 100MB.
I would also check memory_limit and make it larger than the above.
Just a shot in the dark.
> My request timeout is at 60 seconds. I tried a higher timeout for the proxy from mod_proxy and it didn’t help. The login-class looks good. In /tmp are files bigger than that size and there is no quota. I tried to play around with mod_reqtimeout and it didn’t help. I found something that this might happen when Apache is compiled with AP2FILTER and it isn’t. I checked the involved .htaccess and there are php value-directives.
> The crazy thing is: I have an Ubuntu 18.04 with pho 7.1, the same php-settings and Apache-configuration (or as close as I could get them) and there it works perfectly fine.
> Does anybody have any idea what could be the problem or another idea where I could look? I checked now everything I could imagine and I just can’t explain why the php suddenly hangs, then dies and unlinks the temporary file. There are no errors in the php_error.log. There is nothing in the php-fpm.log.
> I see only this in the Apache-log:
> [Tue Jun 08 14:23:56.744245 2021] [proxy_fcgi:error] [pid 2700:tid 34504518400] (70007)The timeout specified has expired: [client XXX.XXX.XXX.XXX:51340] AH01075: Error dispatching request to : (reading input brigade), referer: https://website.TLD/path/to/script.php
> Any idea would be helpful. Maybe a sysctl that could matter? Some config in /etc I am overlooking? I just can’t explain it.
> Desperate greetings,
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
More information about the freebsd-questions