I know php-fpm isn't intended to be used from bash as much as, say, php-cli, but I'm making a common interface for my website from both my broswer and the command line, and I need the executing version to be exactly the same.
echo '<?php echo 1' | socat - UNIX-CLIENT:/var/run/php/php7.2-fpm.sock
doesn't work, but I guess it is maybe because I don't extract the output, but either way I wouldn't know how to do that.
Any idea ?
You should not. As @Barmar pointed out in the comments, just ensure php-cli has the same php.ini file loaded as php-fpm. Then just call php from bash. For me, the solution in an docker environment was to add the last line in this example docker-compose.yml
php-fpm:
build: phpdocker/php-fpm
working_dir: /app
environment:
PHP_IDE_CONFIG: "serverName=Docker"
volumes:
- '../xy:/xy'
- './phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/8.1/fpm/conf.d/99-overrides.ini'
- './phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/8.1/cli/conf.d/99-overrides.ini'
Where /phpdocker/php-fpm/php-ini-overrides.ini is my custom ini file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With