Skip to content

POST a request to PHP-FPM

Without a webserver like nginx or Apache, a tool called cgi-fcgi can be used to query a PHP-FPM process.

Install cgi-fcgi

To send a POST request directly to PHP-FPM a fcgi tool is needed:

  • On macOS brew install fcgi
  • On Debian apt-get install libfcgi0ldbl

Send a POST request

echo '{"query": "{allCities { edges {node {id}}} }"}' | \
SCRIPT_NAME=/var/www/app/public/index.php \
SCRIPT_FILENAME=/var/www/app/public/index.php \
DOCUMENT_ROOT=/var/www/app/public \
HTTPS=true \
REQUEST_URI=/graphql/public \
CONTENT_TYPE=application/json \
cgi-fcgi -bind -connect


Links to this note

These notes are unpolished collections of thoughts, unfinished ideas, and things I want to remember later. In the spirit of learning in public, I'm sharing them here. Have fun exploring, if you want!
© 2022 by Adrian Philipp