在Virtual Host FPM / FastCGI中设置PHP限制

I am trying to create individual setting of PHP (like memory_limit..) for Virtual Hosts But I dont know how could I do that.

I am using Fedora 27 deamon httpd, VHosts works good. When I put SetEnv PHPRC /var/www/pokus.cz/php.ini it doesnt work ( Yes I reloaded deamon).

I try just write php_value memory_limit 64M to VHost.conf file but it prints error

Invalid command "php_value"

I Think that, it is because there is no mod_php in Fedora 27 httpd, but it uses FPM/FastCGI. How could I solve that, Thanks alot for any advise :)

If you want to set individual PHP parameters to your VHosts on server and there is PHP-FPM running on it, you could specify it by different FPM pools.

Just copy the default FPM pool called www (etc/php-fpm.d/www.conf) and edit: name parameter (specify new socket name) and listen parameter (specify new socket name, which will VHost run) (You can edit the php parameters there, like memory_limit...)

Now you have to add this to your VHost conf file:

    <FilesMatch \.(php|phar)$>
     SetHandler "proxy:unix:/run/php-fpm/yourchoosenname.sock|fcgi://localhost"
   </FilesMatch>

This will start your php scripts on new FPM pool for this specific VHost.

Dont forget to reload your web server (I use Apache, so systemctl reload httpd) and PHP-FPM.