Php.ini
From JumbaWiki
- The title of this article should be php.ini. The initial letter is capitalized due to technical restrictions.
php.ini is a plain text configuration file for PHP. The main php.ini affects all users on the server, but you can also create your own php.ini file to override individual settings from the main php.ini.
Contents |
User php.ini
With some server configurations, a php.ini file in your root directory (public_html) will apply to PHP scripts at that level and all subdirectories. However with servers running PhpSuExec, you will usually need a separate php.ini in each directory where it is required. To avoid this requirement and only have one php.ini file that applies to all directories, you can add this line to your .htaccess file:
SetEnv PHPRC /home/myusername/public_html/subdir
then the php.ini in that directory will apply to your whole site.
Common settings
There are many many directives that can be set with php.ini, but only a few are commonly required at the user level.
In the following settings, bytes is normally an integer, but you can also use the shortcuts K, M and G for Kilobytes, Megabytes and Gigabytes respectively (G is available since PHP 5.1.0). For example 1K is the same as 1024, and 1M is the same as 1048576.
- upload_max_filesize = bytes
- The maximum size of an uploaded file.
- post_max_size = bytes
- The maximum size of post data allowed. This setting also affects file uploads; to upload large files, this value must be larger than upload_max_filesize.
- max_execution_time = seconds
- The maximum time a script is allowed to run before it is terminated by the parser.
- max_input_time = seconds
- The maximum time a script is allowed to parse input data, like POST, GET and file uploads.
- memory_limit = bytes
- The maximum amount of memory that a script is allowed to allocate. This also affects file uploading; generally speaking, memory_limit should be larger than post_max_size.
Example php.ini
By default, PHP only allows files less than 2 MB to be uploaded. Here is an example php.ini file that will allow your users to upload files up to 10 MB in size.
upload_max_filesize = 10M post_max_size = 11M
PHP configuration
php.ini files are just one way of setting directives for PHP (and usually the easiest way).
PHP itself has functions for setting some values (eg ini_set()) and some servers
allow you change PHP settings in an .htaccess file.

