How can I make edits or changes to php.ini?


Important Notes:

  • Often times a web application will need specific settings changed for php to run the application correctly. These changes are made to the php.ini file. To edit the php.ini file you will first need to connect to your server via SSH or Remote Desktop. The php.ini file cannot be edited using FTP or Plesk.

    ******Before making any changes to your php.ini file be sure to make a backup******

What is php.ini?
Simply put, the php.ini file is the configuration file that tells PHP how to operate. There are many options in the php.ini file which are covered below.

I've never made changes to a configuration file before, what am I looking at?

If you've never edited a configuration file before, the php.ini file can look a bit intimidating. As a general rule of thumb, if you do not know what an option does, leave it alone. Also, you'll see many lines that start with a semicolon ';'. The semicolon means that the line is ignored and the option is not read by PHP.

Heres an example of an option that is commented out:

;open_basedir =

The 'open_basedir' option will not be read by the php.ini file, it's as if the open_basedir option is not there.


 

What are some of the most common settings in php.ini?

 

 

  1. safe_mode - This setting is primarily intended to provide file access limits to prevent users from accessing files that do no belong to them. This supposedly should make it impossible to access files of other people in a shared server environment. The are several problems with safe_mode. Many scripts and content management programs (joomla or wordpress) are unable to operate with it turned on. The value for this options is boolean, meaning it should either be set to 'On' or 'Off'.

  2. error_reporting - Error reporting can be very useful to a developer working on a new script. However, by enabling this option you're broadcasting a lot of sensitive information to users. This information can be used to attack or compromise your server. Error reporting should only be turned on if you are in the process of developing. For production servers we recommend that you leave this feature off and instead use error logging. See below for more information on error logging and the options that can be used:

    Typically, if you're in development you can use the following value to turn on reporting:

    E_ALL - All errors and warnings (doesn't include E_STRICT)

  3. log_errors - This option saves all errors to a log file rather than sending the error to the users web browser. This is a much safer option than error_reporting for production servers. The value for this options is boolean, meaning it should either be set to 'On' or 'Off'.

    • log_errors_max_len - The value for this option determines how many characters the log will for any given entry. By default, the value is 1024. If you would prefer no limit on this option, simply set the value to 0.

    • error_log = filename - Logs errors to the specified file name and location.

      Example: error_log = /var/log/php_error_log

     

  4. register_globals - By default this option is set to "Off". In most circumstances it should remain "Off" because of the security vulnerabilities associated with this option. You should try your hardest during development to ensure that you don't require register_globals to be on. However, sometimes there is a need to enable this selection. The value for this options is boolean, meaning it should either be set to 'On' or 'Off'.

  5. file_uploads- This option simply determines whether or not to allow HTTP file uploads. The value for this options is boolean, meaning it should either be set to 'On' or 'Off'.

    • upload_max_filesize - Specifies the maximum allowed file size uploaded through PHP/HTTP. By default the value is set to '2M' and can be replaced with a reasonable file size.

      Example: upload_max_filesize = 32M

      This article has been provided by Codero Hosting, the leading provider of reliable Dedicated, Cloud, Hybrid, and Managed
       hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit www.codero.comchat with us online or give us a call at 866-2-CODERO.   
Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)