How edit php settings (php.ini) of virtual servers in virtualmin


PHP files can be configured to run in several ways in Virtualmin including but not limited to:

- Apache mod_php
- Fastcgi

To change php settings for the virtual server, you first need to find out which php execution method is set for your website.
You can find this by phpinfo() function, to do so just create a php file on your account and put the following code inside the file:

<?php phpinfo(); ?>

and then open the script in your website to see the Server API  and Loaded Configuration File .

Then check if the Server API has the word FPM , if it has FPM then you are running on PHP-FPM
and you should follow the FPM section of this article.

If the Server API doesn't include the word FPM then you are running non-FPM method.
You should read the NON-FPM section of this article

Updating PHP settings on PHP-FPM handler:

If you want to change a php setting for all virtual servers on your VPS you can edit the file specified in
Loaded Configuration File above and update the setting.
If you want to change a php setting just for one virtual-server, you should open the fpm config of the virtual-server inside the your php-fpm config folder which is:

PHP v5.x on Debian OS: /etc/php5/fpm/pool.d/
PHP v7.x on Debian OS: /etc/php/7.0/fpm/pool.d/

PHP v5.x on Centos distros: /etc/php-fpm.d/
PHP v7.x on Centos distros: /etc/opt/remi/php70/php-fpm.d/

You should look for a file 12345.conf where 12345 is the userid of your virtual server's user. You can get the user by running id USERNAME command in SSH where username is the username of your virtual-server. Edit the file and set your variable in the following format:

php_admin_value["display_errors"] = 1

and save the file.

You then need to apply the configuration by reloading php-fpm process:

PHP v5.x on Debian : service php5-fpm restart
PHP v7.x on Debian : service php7.0-fpm restart

PHP v5.x on Centos : service php-fpm restart
PHP v7.x on Centos : service php70-php-fpm restart

Updating PHP settings on NON-FPM handler:

You should use Virtualmin interface to update the PHP settings.