Nginx – How to set PHP include_path for php-fpm in nginx config

apache-2.2nginxphp-fpm

I'm trying to migrate from Apache to nginx. In my Apache conf file I had

php_value include_path "/home/my-app/topincs/php:/home/my-app/topincs/vendor/php"

Now I got

fastcgi_param  PHP_VALUE  "include_path=/home/my-app/topincs/php:/home/my-app/topincs/vendor/php";

in my nginx's fastcgi_params file, but it seems the include path is not used by php-fm as I'm getting the following error.

PHP message: PHP Warning:  require_once(Response.php): failed to open stream: No such file or directory in /home/my-app/topincs/docroot/.start on line 3

Whereas the file Response.php does exist in the directory /home/my-app/topincs/php.

How should I set it so that php-fpm recognize it?

Best Answer

You can set php values directly in your fpm-pool configuration file like this:

php_value[include_path]  = "/home/my-app/topincs/php:/home/my-app/topincs/vendor/php"

You don't need to set it in your nginx configuration.