Modify Your PHP Configuration: Difference between revisions


No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
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:
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:
!Common PHP Directives
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 [[HTACCESS|documentation for .htaccess]] file for further information.
!
 
|-
==== '''PHP Directives''' ====
|php_value max_file_uploads 100
Some of the more common settings that are used in the PHP environment are listed below:
 
'''Common PHP Directives'''


<pre style="white-space: pre-wrap;">
php_value max_file_uploads 100
php_value max_input_vars 5000
php_value max_input_vars 5000
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
|
</pre>
|-
|
|
|-
|
|
|}


Please refer to [https://www.php.net/manual/en/ini.list.php this link] for a current exhaustive list of PHP settings.  The settings can be set using an .htaccess fileWe do not support setting these values in a php.ini file.
Refer to the PHP documentation for an [https://www.php.net/manual/en/ini.list.php exhaustive list of PHP directives].   


==== View your own current PHP settings ====
===='''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:
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(); ?>
  <?php phpinfo(); ?>
upload it to the root of your website and navigate to it:  
upload it to the root of your website and navigate to it:  
  <nowiki>https://example.com/phpinfo.php</nowiki>
  <nowiki>https://example.com/phpinfo.php</nowiki>


===== '''How to edit a file using the Bravenet editor.''' =====
====='''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
|-
|-
|Login to the Bravenet Console
|'''Login to the Bravenet Console'''
|-
|-
|Web Hosting
|Web Hosting
Line 55: Line 46:
Type the following in line 1 '<?php phpinfo(); ?>'
Type the following in line 1 '<?php phpinfo(); ?>'


File Name: phpinfo.php, click Save
File Name: phpinfo.php
 
click Save
|-
|-
|
|
|}
|}


 
====='''View Your Environments PHP Settings'''=====
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:
Type the following in the browsers address bar to view your current PHP Settings
  php_value memory_limit 512M
  [https://example.com/ https://example.com/phpinfo.ph]
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:
You can easily find things by using the search function of your Web Browser.
php_value upload_max_filesize 10M
refer to our documentation on .htaccess file for further details https://wiki.bravenet.com/HTACCESS


[[Category:PHP]]
[[Category:PHP]]

Latest revision as of 10:49, 17 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.

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.