Joyent

Translations of this page:

PHP configuration

To determine the configuration of PHP on a shared server, run the following command from a shell account (or by 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 directory or a subdirectory thereof, with the following contents:

<?php phpinfo(); ?>

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

  1. Sign in to Virtualmin (see Account logins and important URLs).
  2. Pick a virtual server that you want to configure PHP for.
  3. Click Services in the left-hand navigation, then click PHP 5 Configuration (or PHP 4 Configuration if this is for PHP 4).
  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:

  1. Sign in to Virtualmin (see Account logins and important URLs).
  2. Pick a virtual server that you want to configure PHP for.
  3. Click Services in the left-hand navigation, then click PHP 5 Configuration (or PHP 4 Configuration if this is for PHP 4).
  4. Click Error Logging
  5. For Display error messages? select Yes
  6. 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
  7. 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.

 
shared/kb/php-config.txt · Last modified: 2009/04/01 12:56 by filip
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki