How to use the "php_admin_value" flag in virtualhost through PHP-FPM in a specific Virtual Host?

1

I decided to swap Apache2Handler with PHP-FPM on my server. After this change, I tried to run sudo apache2ctl configtest and got the following error:

  

AH00526: Syntax error on line 53 of /etc/apache2/apache2.conf :   Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration   Action 'configtest' failed.   The Apache error log may have more information.

I know that it is possible to make this adaptation through the www.conf file of PHP FPM, however the issue is that I need this to work for a specific virtualhost, not for everyone.

Example:

#/etc/apache2/sites-avaliable/projeto_x.conf

<Directory /home/servidor/projeto_x>
    php_admin_value open_basedir /home/servidor/projeto_x
AllowOverride All
</Directory>

How can I make this setting through PHP FPM for a specific VHost?

    
asked by anonymous 02.10.2017 / 16:34

1 answer

1

I do not know if I understand correctly, maybe that's for sure, if you do not comment on me to erase the wrong answer, or if I can delete that line.

1 - Create a group and a user for this host (they will serve to identify which site / system this host receives)

I used 'test' as an example.

2 - Create an exclusive conf file for this site / project

sudo vim /etc/php5/fpm/pool.d/teste.conf

And in this file:

[teste]
user = teste
group = teste
listen = /var/run/php5-fpm-teste.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = comando1,comando2
php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

3 - Restart php-fpm

sudo service php5-fpm restart

4 - At this point a test process should already be running, use the command below to find out:

ps aux |grep teste
    
02.10.2017 / 19:22