Modify Your PHP Configuration: Difference between revisions


No edit summary
No edit summary
Line 12: Line 12:
php_value max_execution_time 300
php_value max_execution_time 300
php_value max_input_time 300
php_value max_input_time 300
php_value post_max_size 128M
php_value post_max_size 128M
php_value upload_max_filesize 256M
php_value upload_max_filesize 256M
php_value session.gc_maxlifetime 1200
php_value session.gc_maxlifetime 1200
php_value memory_limit 512M
php_value memory_limit 512M
|
|

Revision as of 15:48, 14 February 2023

The PHP framework provides directives (you can think of them as settings) to tune or change the behavior of the PHP environment. For example, often you will need to change the maximum memory available in the PHP environment to Content Management Systems like WordPress. You can make those changes with the use of the .htaccess file and knowing which PHP directive to use. Some of the more common settings that are used are listed below:

Common PHP Directives
php_value max_file_uploads 100

php_value max_input_vars 5000 php_value max_execution_time 300 php_value max_input_time 300 php_value post_max_size 128M php_value upload_max_filesize 256M php_value session.gc_maxlifetime 1200 php_value memory_limit 512M

Common PHP Directives
php_value max_file_uploads 100

php_value max_input_vars 5000 php_value max_execution_time 300 php_value max_input_time 300 php_value post_max_size 128M php_value upload_max_filesize 256M php_value session.gc_maxlifetime 1200 php_value memory_limit 512M


Please refer to this link for a current exhaustive list of PHP settings. The settings can be set using an .htaccess file. We do not support setting these values in a php.ini file.

To view the default settings in our server environment, use the PHP-command phpinfo(). Create a new PHP file called phpinfo.php with the following content:

<?php phpinfo(); ?>

upload it to the root of your website and navigate to it:

https://example.com/phpinfo.php

How to edit a file using the Bravenet editor.

Login to the Bravenet Console
Web Hosting

example.com > Manage

File Manager

New File

Type the following in line 1 '<?php phpinfo(); ?>'

File Name: phpinfo.php, click Save


If for example you wanted to change the PHP memory limit available to your website to to 512 MB, set the php_value memory_limit value. It currently defaults to 256 MB but you can change it to 512 MB with:

php_value memory_limit 512M

If you wanted to change the maximum file size that can be uploaded set the upload_max_filesize value. You can change it to 10 MB with:

php_value upload_max_filesize 10M

refer to our documentation on .htaccess file for further details https://wiki.bravenet.com/HTACCESS