2

I am trying to alter some php.ini values for a single site of my web server:

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

but the value is totally ignored by FPM.

I have tried to add the line either on top of the vhost configuration or under the location ~* .php$ { directive but none works

Here is my vhost configuration under nginx:

server { listen 80; index index.php index.html; server_name myvisit; root /var/www/mv/head/myvisit/; access_log /var/log/nginx/myvisit-access.log; error_log /var/log/nginx/myvisit-error.log; fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/profile/external/header.php \n auto_append_file=/var/www/profile/external/footer.php"; # Use gzip compression # gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 5; gzip_buffers 16 8k; gzip_http_version 1.0; gzip_types text/plain text/css application/json application/x-javascript text/xml application/$ # error pages error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www; } # Deny access to hidden files location ~* /\.ht { deny all; access_log off; log_not_found off; } location / { try_files $uri $uri/ /index.php?$args; } location ~* /myvisitv3[-_](.*)\.(?:html|php) { try_files $uri $uri/ /myvisitv3.php?libAdresse=$1&$args; } location ~* /favicon.(?:ico|png|bmp|jpg)$ { try_files $uri $uri/ /web/img/favicon.ico; } # Pass PHP scripts on to PHP-FPM include global/php-fpm.conf; location ~* \.php$ { include /etc/nginx/fastcgi_params; try_files $uri /index.php; fastcgi_index index.php; fastcgi_pass php5-fpm-sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/profile/external/header.php \n auto_append_file=/var/www/profile/external/footer.php"; } } 

2 Answers 2

1

It does not work in all Linux distributions. For details see the comments on PHP bug #51595

4
  • awwww ! is there a workaround to make it works only for a given vhost ? Commented May 16, 2013 at 8:23
  • 3
    If you have a separate FPM pool for each vhost (and you should for security), you can just put the config into the vhost's FPM pool. Commented May 16, 2013 at 8:32
  • ok i'll check how to do that :) Commented May 16, 2013 at 8:33
  • Based on that bug, it may be an escaping issue for some reason. Commented Nov 14, 2014 at 3:42
0

It works for me, but only in location context. In server context it works different as one could expect. Discussed on nginx forum: fastcgi_param in server context does not work.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.