How to set core PHP directives (e.g. upload_max_filesize)

Some PHP scripts may require settings different from the defaults configured in the server's php.ini file. You can change many of these settings by using php_value and php_flag directives in the .htaccess file in your web site's root folder.

Here are a few example settings:
(do not just add these, only change what is required by your scripts/website coding)

php_value include_path ".:/usr/local/lib/php"
php_flag display_errors Off
php_value post_max_size 15M
php_value upload_max_filesize 15M

Some notes from the documentation on post_max_size and upload_max_filesize:

post_max_size sets the maximum size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do I enable PHP error logging?

To enable PHP error logging, simply add the following lines to your website's main .htaccess...

How do I disable the server RAM cache during website development?

The web servers are installed with a RAM cache to help speed up your website. The caching...

How do I enable PHP short tags?

PHP short tags description from the official PHP documentation: When PHP parses a file, it looks...