Modify Your PHP Configuration: Difference between revisions


No edit summary
No edit summary
Line 60: Line 60:
  <nowiki>https://example.com/phpinfo.php</nowiki>
  <nowiki>https://example.com/phpinfo.php</nowiki>


==== '''Modify a PHP Setting''' ====
===== '''Create a php file to view your PHP Settings''' =====
{| class="mw-collapsible mw-collapsed"
{| class="mw-collapsible mw-collapsed"
|+How To edit a file using the Bravenet Editor
|+How To edit a file using the Bravenet Editor
Line 81: Line 81:




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:
'''View Your Environments PHP Settings'''
 
Type the following in the browsers address bar to view your current PHP Settings
[https://example.com/ https://example.com/phpinfo.ph]
You can easily find things by using the search function of your Web Browser.
 
==== Set a PHP Setting ====
If for example you wanted to change the PHP memory limit available to your website 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
  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:
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:

Revision as of 15:46, 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


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.

View your own current PHP settings

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
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.

Set a PHP Setting

If for example you wanted to change the PHP memory limit available to your website 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