====== PHP configuration ======
To determine the configuration of PHP on a shared server, run the following command from a shell account (or by [[run-commands|running the command in Virtualmin]]):
php -i
This command will tell you the PHP configuration (stored in ''/usr/local/etc/php.ini'') of the shared server.
To the check the current configuration of PHP for a virtual server on your account, create a new PHP file (e.g. //phpinfo.php//) somewhere in your [[document-root]] or a subdirectory thereof, with the following contents:
and access that file from your browser using your virtual server's hostname (e.g. navigating to %%http://domain.com/phpinfo.php%% - depending on where you put the file).
Every virtual server you create (see [[domains]]) will have its own php.ini file (which is a copy of server wide shared one in ''/usr/local/etc/php.ini'') and stored under the ''~/etc'' directory for each virtual server.
If you need to change some common settings under PHP for your account (like error reporting), you can do so through Virtualmin.
To use PHP on the command line with the configuration of one of your virtual servers, instead of the shared configuration, use the -c switch:
php -c /path/to/your/php.ini ...
===== Customizing your PHP configuration =====
- Sign in to Virtualmin (see [[Logins]]).
- Pick a virtual server that you want to configure PHP for.
- Click **Services** in the left-hand navigation, then click **PHP 5 Configuration** (or **PHP 4 Configuration** if this is for PHP 4).
- You should now see a page listing all the available settings you can edit such as PHP Variables, Directory Settings, and Error Logging.
As an example, if you'd like enable error reporting do this:
- Sign in to Virtualmin (see [[Logins]]).
- Pick a virtual server that you want to configure PHP for.
- Click **Services** in the left-hand navigation, then click **PHP 5 Configuration** (or **PHP 4 Configuration** if this is for PHP 4).
- Click **Error Logging**
- For //Display error messages?// select **Yes**
- For //Error types to display//, select the type of errors you'd like to see. So see all error types, select **All errors and warnings**
- Click **Save**
If you prefer, you may also edit the 'etc/php5/php.ini' or 'etc/php4/php.ini' files (under the home directory of the respective virtual server) to achieve the same effect.
Changes made to your PHP configuration will not take effect until your local PHP process is restarted, which occurs after 2 minutes of inactivity. If you are impatient or receive heavy traffic to your site, you will want to manually restart PHP by logging into your account via SSH and executing ''pkill php''.