How to define env values that start with dollar sign in php-fpm
I need to define a variableSOMECONFIG
in php-fpm with a string$hello
(a literal string that starts with a dollar sign)
If I put it like
env['SOMECONFIG']=$hello
It won't work because php-fpm will try to evaluate$hello
from the environment variables which is not defined. The result of$_SERVER['SOMECONFIG']
in php code will be an empty string.
What's strange about php-fpm is if the dollar sign is NOT at the beginning of the string, it can be defined without issues, the following works:
env['SOMECONFIG']=after$hello
I've also tried with\$hello
,$$hello
,'$hello'
, or"$hello"
without luck.
Thoughts?
Answer
Solution:
I found a workaround. Set the base64 encoded of "$hello" to an environment variable and decode it when use it.
in parameters.yml in Symfony3.4, I was able to get the value like this: %env(base64:SOMECONFIG)%