PHP-FPM, Nginx, PHP_VALUE, and Multiple Values

Posted by on April 23rd, 2012

Quick little post on a problem I had while trying to use XHGui with my Nginx/PHP-FPM setup. I needed to be able to pass the auto_prepend_file and auto_append_file settings to PHP-FPM from Nginx. In apache you can declare multiple php_value settings. However, when I did the same in nginx, it would only reflect the second setting. Turns out you need to set all of your php_value’s in Nginx in a single string, and you separate them by new line characters. Here is how it should look:


location ~ .php$ {

expires off;

include /etc/nginx/fastcgi_params;


fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /var/www//httpdocs/$fastcgi_script_name;

fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/xhprof/external/header.php \n auto_append_file=/var/www/xhprof/external/footer.php";




Justin is a Sr. Director of Engineering at Deseret Digital Media, Previous President of the Utah PHP Usergroup, and frequently works with the Utah Open Source Foundation which organizes the OpenWest Conference. Justin loves just about anything with web technologies from PHP, JavaScript, Node.js, Salt, and managing engineering teams.

Learn More