r/PHPhelp • u/Striking-Bat5897 • Jan 29 '25
PHP 8.3 - fpm and post data
I have a symfony application and getting a POST request from a remote service. When receiving with an Apache webserver with php 8.3, i can get the POST data with $data = file_get_contents("php://input").
It's not working on a Nginx webserver. then $data is empty. The difference is apache PHP is a module, on nginx it's fpm.
Sorry if i should ask this in r/nginx
4
Upvotes
1
u/colshrapnel Jan 29 '25
A quick google found this. If you open Developer tools, Network tab, tick the Preserve log and make your request, does it appear alone with 200 status or it result in 3xx and then another? In the latter case, it's a misconfigured redirect
1
u/lsv20 Jan 30 '25
Why would you use php://input?
You have a symfony application, and properly also a route for
/cxml/orderSo why not useRequest?2
u/allen_jb Jan 29 '25
Be aware that in many cases different SAPIs (ways of running PHP - eg. Apache Module, PHP-FPM, cli) have different config (php.ini) files. phpinfo() from a web request will tell you which ini files were read in the top section.
Have you verified the POST data is actually sent from the client (check the request data in browser dev tools network tab)?
What's the value of the
post_max_sizeini setting? (Verify using phpinfo() from a web request)Are file uploads involved? If so, does it work without uploading a file (so the request just contains other POST data)?
What's your nginx configuration (specifically in regards to PHP, and URL handling such as redirects / rewrites)?