Skip to content
Advertisement

Apache not return Laravel json validation errors on Test but works on Dev

I’ve been working on a Laravel API with validation. I’m sending this request to the server:

JavaScript

On my development system, running windows/Apache/PHP 8.1, the POST requests return a JSON object containing validation errors.

JavaScript

But my test system, running Linux/Apache/PHP 8.1, does not return a JSON response:

JavaScript

Here is my code:

api.php

JavaScript

StoreClientRequest.php

JavaScript

ClientAPIController.php

JavaScript

Since it’s working on my localhost I don’t believe it is the code. I’m guessing it’s an issue with Apache or PHP configuration on the Test server but I’m not seeing anything different as far as I can tell. As one is Windows and the other Linux, it’s not straight forward to check the differences.

Any reason I’m not getting a JSON response back from the test server?

Advertisement

Answer

It does appear to be an issue with Apache dropping the body of the response when using php-fpm. I tested a couple of different configurations of Apache, Nginx, mod-php, and php-fpm.

Server PHP Response body
Apache mod-php Included
Apache php-fpm Missing
Nginx php-fpm Included

I found a few links with an issue with the request body being drop so may be the same thing or something similar.

https://www.jeffgeerling.com/blog/2017/apache-fastcgi-proxyfcgi-and-empty-post-bodies-chunked-transfer

Looks like I will need to upgrade the other apps to PHP 8 so I can switch back to mod-php or move to nginx. Thanks for the help everyone.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement