What is php ini settings?

Whether you are looking to make some custom changes to your PHP settings or just switched PHP versions and the wrong settings are being loaded, you may need the default PHP.ini file for your current PHP version. Below we will go over why this file can be important.

What does the PHP.ini file do?

The php.ini file contains all of the current PHP configuration settings: such as the execution time, memory limit, etc. This is also how PECL modules are enabled such as memcache, APC, etc. This file allows you to override the server’s default configuration settings.

Setting up a new php.ini file

Easy way to load up a copy of the PHP.INI file

The PHP Configuration option is available in shared server accounts [this includes Reseller accounts]. The dedicated/VPS accounts will only have the PHP Configuration option if it has been loaded. This option provides a quick and easy way to load up a PHP.INI file without having to manually create it.

  1. Log into your cPanel account  
  2. Go to the Software and Services section, then click on PHP Configuration [or MultiPHP Manager for VPS users]
  3. Make sure you’re using the PHP version you want [if you’re not sure, then leave it as it is], then click on the Update button.

That will create the default PHP.INI file in your PUBLIC_HTML folder.

How to Manually Create a PHP.INI file

Clicking on the button for your PHP version will open a new window containing the correct php.ini file for that version. Below are the steps for adding a php.ini file to your account.

  1. Log into your cPanel account
  2. Open your File Manager

  3. Navigate to your public_html directory

  4. Create a new file

  5. Name it php.ini

  6. Edit the php.ini file you just created

  7. Copy and Paste the default php.ini code from the copy of the default version below.
  8. Click Save Changes
[PHP]
 ;;;;;;;;;;;;;;;;;;;
 ; About php.ini   ;
 ;;;;;;;;;;;;;;;;;;;
 ; PHP's initialization file, generally called php.ini, is responsible for
 ; configuring many of the aspects of PHP's behavior.
 ; PHP attempts to find and load this configuration from a number of locations.
 ; The following is a summary of its search order:
 ; 1. SAPI module specific location.
 ; 2. The PHPRC environment variable. [As of PHP 5.2.0]
 ; 3. A number of predefined registry keys on Windows [As of PHP 5.2.0]
 ; 4. Current working directory [except CLI]
 ; 5. The web server's directory [for SAPI modules], or directory of PHP
 ; [otherwise in Windows]
 ; 6. The directory from the --with-config-file-path compile time option, or the
 ; Windows directory [C:windows or C:winnt]
 ; See the PHP docs for more specific information.
 ; //php.net/configuration.file
 ; The syntax of the file is extremely simple.  Whitespace and lines
 ; beginning with a semicolon are silently ignored [as you probably guessed].
 ; Section headers [e.g. [Foo]] are also silently ignored, even though
 ; they might mean something in the future.
 ; Directives following the section heading [PATH=/www/mysite] only
 ; apply to PHP files in the /www/mysite directory.  Directives
 ; following the section heading [HOST=www.example.com] only apply to
 ; PHP files served from www.example.com.  Directives set in these
 ; special sections cannot be overridden by user-defined INI files or
 ; at runtime. Currently, [PATH=] and [HOST=] sections only work under
 ; CGI/FastCGI.
 ; //php.net/ini.sections
 ; Directives are specified using the following syntax:
 ; directive = value
 ; Directive names are case sensitive - foo=bar is different from FOO=bar.
 ; Directives are variables used to configure PHP or PHP extensions.
 ; There is no name validation.  If PHP can't find an expected
 ; directive because it is not set or is mistyped, a default value will be used.
 ; The value can be a string, a number, a PHP constant [e.g. E_ALL or M_PI], one
 ; of the INI constants [On, Off, True, False, Yes, No and None] or an expression
 ; [e.g. E_ALL & ~E_NOTICE], a quoted string ["bar"], or a reference to a
 ; previously set variable or directive [e.g. ${foo}]
 ; Expressions in the INI file are limited to bitwise operators and parentheses:
 ; |  bitwise OR
 ; ^  bitwise XOR
 ; &  bitwise AND
 ; ~  bitwise NOT
 ; !  boolean NOT
 ; Boolean flags can be turned on using the values 1, On, True or Yes.
 ; They can be turned off using the values 0, Off, False or No.
 ; An empty string can be denoted by simply not writing anything after the equal
 ; sign, or by using the None keyword:
 ;  foo =         ; sets foo to an empty string
 ;  foo = None    ; sets foo to an empty string
 ;  foo = "None"  ; sets foo to the string 'None'
 ; If you use constants in your value, and these constants belong to a
 ; dynamically loaded extension [either a PHP extension or a Zend extension],
 ; you may only use these constants after the line that loads the extension.
 ;;;;;;;;;;;;;;;;;;;
 ; About this file ;
 ;;;;;;;;;;;;;;;;;;;
 ; PHP comes packaged with two INI files. One that is recommended to be used
 ; in production environments and one that is recommended to be used in
 ; development environments.
 ; php.ini-production contains settings which hold security, performance and
 ; best practices at its core. But please be aware, these settings may break
 ; compatibility with older or less security conscience applications. We
 ; recommending using the production ini in production and testing environments.
 ; php.ini-development is very similar to its production variant, except it is
 ; much more verbose when it comes to errors. We recommend using the
 ; development version only in development environments, as errors shown to
 ; application users can inadvertently leak otherwise secure information.
 ; This is php.ini-production INI file.
 ;;;;;;;;;;;;;;;;;;;
 ; Quick Reference ;
 ;;;;;;;;;;;;;;;;;;;
 ; The following are all the settings which are different in either the production
 ; or development versions of the INIs with respect to PHP's default behavior.
 ; Please see the actual settings later in the document for more details as to why
 ; we recommend these changes in PHP's behavior.
 ; display_errors
 ;   Default Value: On
 ;   Development Value: On
 ;   Production Value: Off
 ; display_startup_errors
 ;   Default Value: Off
 ;   Development Value: On
 ;   Production Value: Off
 ; error_reporting
 ;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
 ;   Development Value: E_ALL
 ;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
 ; html_errors
 ;   Default Value: On
 ;   Development Value: On
 ;   Production value: On
 ; log_errors
 ;   Default Value: Off
 ;   Development Value: On
 ;   Production Value: On
 ; max_input_time
 ;   Default Value: -1 [Unlimited]
 ;   Development Value: 60 [60 seconds]
 ;   Production Value: 60 [60 seconds]
 ; output_buffering
 ;   Default Value: Off
 ;   Development Value: 4096
 ;   Production Value: 4096
 ; register_argc_argv
 ;   Default Value: On
 ;   Development Value: Off
 ;   Production Value: Off
 ; request_order
 ;   Default Value: None
 ;   Development Value: "GP"
 ;   Production Value: "GP"
 ; session.gc_divisor
 ;   Default Value: 100
 ;   Development Value: 1000
 ;   Production Value: 1000
 ; session.hash_bits_per_character
 ;   Default Value: 4
 ;   Development Value: 5
 ;   Production Value: 5
 ; short_open_tag
 ;   Default Value: On
 ;   Development Value: Off
 ;   Production Value: Off
 ; track_errors
 ;   Default Value: Off
 ;   Development Value: On
 ;   Production Value: Off
 ; url_rewriter.tags
 ;   Default Value: "a=href,area=href,frame=src,form=,fieldset="
 ;   Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
 ;   Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
 ; variables_order
 ;   Default Value: "EGPCS"
 ;   Development Value: "GPCS"
 ;   Production Value: "GPCS"
 ;;;;;;;;;;;;;;;;;;;;
 ; php.ini Options  ;
 ;;;;;;;;;;;;;;;;;;;;
 ; Name for user-defined php.ini [.htaccess] files. Default is ".user.ini"
 ;user_ini.filename = ".user.ini"
 ; To disable this feature set this option to empty value
 ;user_ini.filename =
 ; TTL for user-defined php.ini files [time-to-live] in seconds. Default is 300 seconds [5 minutes]
 ;user_ini.cache_ttl = 300
 ;;;;;;;;;;;;;;;;;;;;
 ; Language Options ;
 ;;;;;;;;;;;;;;;;;;;;
 ; Enable the PHP scripting language engine under Apache.
 ; //php.net/engine
 engine = On
 ; This directive determines whether or not PHP will recognize code between
 ;  tags as PHP source which should be processed as such. It is
 ; generally recommended that  should be used and that this feature
 ; should be disabled, as enabling it may result in issues when generating XML
 ; documents, however this remains supported for backward compatibility reasons.
 ; Note that this directive does not control the 

Bài mới nhất

Chủ Đề