====== 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]]).
- Click **Webmin Modules** in the left-hand navigation, then click **PHP Configuration**. You should now see a listing of PHP configuration files for each of your domains.
- Under the //Actions// column, click **Manage** for the domain whose PHP setting you'd like to edit. You should now see a page listing all the available settings you can edit such as PHP Variables, Safe Mode Options, and Error Logging.
As an example, if you'd like enable error reporting do this:
- Sign in to Virtualmin (see [[Logins]]).
- Click **Webmin Modules** in the left-hand navigation, then click **PHP Configuration**. You should now see a listing of PHP configuration files for each of your domains.
- Under the //Actions// column, click **Manage** for the domain whose PHP setting you'd like to edit
- 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 ~/etc/php5/php.ini or ~/etc/php4/php.ini within your account 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''.
The Virtualmin controls only provide for some select PHP options that can be changed this way. Virtualmin will let you change the php.ini file directly though, by clicking **Edit Manually** (instead of //Manage//) on the //PHP Configuration// page.