Modify Your PHP Configuration


Revision as of 10:49, 17 February 2023 by Wikiadmin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Set a PHP Setting

If you wanted to change the PHP memory limit available to your website to 512 MB, set the php_value memory_limit value in your websites .htaccess file, usually found in the root of your website. 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

See the documentation for .htaccess file for further information.

PHP Directives

Some of the more common settings that are used in the PHP environment 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

Refer to the PHP documentation for an exhaustive list of PHP directives.

View your own current PHP settings

To view the default and current settings of PHP in your Bravenet environment, use the PHP-command phpinfo(). Create a new PHP file called phpinfo.php with the following content in the root folder of your website:

<?php phpinfo(); ?>

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

https://example.com/phpinfo.php
Create a php file to view your PHP Settings
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

View Your Environments PHP Settings

Type the following in the browsers address bar to view your current PHP Settings

https://example.com/phpinfo.ph

You can easily find things by using the search function of your Web Browser.