There's a way to per-process override name resolution process-local override of name resolution? using HOSTALIASES. Do you think it's applicable to PHP-FPM workers too? I have this line in /etc/php-fpm.d/www.conf:
env[HOSTALIASES] = /etc/hosts.php-fpm
And when I examine $_SERVER, I see HOSTALIASES, but the actual override in the hosts.php-fpm (127.0.0.1 example.com) is not effective, it's returned from the nameservers. Do you have a suggestion on how to make (a similar solution) work?
You're trying to use HOSTALIASES in the wrong way. To be respected, alias should meet 2 requirements:
So, your record in HOSTALIASES should look like
example someexample.com
In case you need to alias the ip, you can use something like xip.io
Generally, that should work with any php function which relies on gethostbyname (that also true for php-fpm).
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