Showing posts with label php.ini. Show all posts
Showing posts with label php.ini. Show all posts

Thursday 9 October 2014

How to enable and disable the PHP magic quotes directive?

When the magic quotes directive is enabled, PHP automatically escapes 
data from HTTP GET and POST requests and cookie data. For example, 
if a user types “hello” (with the quotation marks) in a form, PHP 
automatically escapes the quotation marks and stores the value as 
\“hello\”. To enable this functionality, use a text editor to 
modify the magic quotes directive in the php.ini file as follows:

magic_quotes_gpc = on

To disable this functionality, modify the magic quotes directive in the php.ini file as follows:

magic_quotes_gpc = off

How to enable and disable the PHP register_globals directive?

When the register_globals directive is enabled, PHP creates variables 
automatically from HTML form parameters and cookie data. 
To enable this functionality, use a text editor to modify the 
register_globals directive in the php.ini file as follows:

register_globals = on

To disable this functionality, modify the register_globals 
directive in the php.ini file as follows:

register_globals = off

How to enable and disable the PHP allow_url_fopen directive?

To enable this functionality, use a text editor to modify 
the allow_url_fopen directive in the php.ini file as follows:

allow_url_fopen = on

To disable this functionality, modify the allow_url_fopen 
directive in the php.ini file as follows:

allow_url_fopen = off

How to change the maximum number of input variables for PHP scripts?

PHP obtains input variables from HTML forms (through GET and POST requests), 
as well as from any cookies enabled on a page. 
By default, the maximum number of input variables allowed for 
PHP scripts is set to 1000. You can change this amount by 
adding the max_input_vars directive to a php.ini file.

To change the maximum number of input variables allowed, use a text editor
 to add the max_input_vars directive to your php.ini file. For example,
 to set the maximum number of input variables to 1500, add the following setting:

max_input_vars = 1500

How to enable and disable the expose_php directive?

When the expose_php directive is enabled, PHP includes the following line in 
the HTTP response header when a PHP page is requested 
(the exact version number may differ depending on your configuration):

X-Powered-By: PHP/5.3.27

By default, the expose_php directive is enabled. However, you may not want to 
broadcast the specific PHP version your site is using. Similarly, 
some third-party applications require the expose_php directive to be disabled.

To disable the expose_php directive, use a text editor to modify your php.ini file as follows:

expose_php = off

With the expose_php directive disabled, PHP will not send the X-Powered-By header. 
To re-enable the expose_php directive and send the X-Powered-By header, 
modify your php.ini file as follows:

expose_php = on

Thursday 25 September 2014

To enable/disable for error message in php.ini file

Enable:
display_errors = on
Disable:
display_errors = off

To modify the maximum number of input variables for PHP scripts in php.ini directives

To modify the maximum number of input variables for PHP scripts in php.ini directives
max_input_vars = 1500

To change the memory limit for PHP in php.ini directives

To change for this in php.ini
memory_limit = 256M

To set the PHP error log location in php.ini directives

PHP error log location in php.ini file
Enable:
error_log = /path/filename
Disable
;error_log = /path/filename

To change the PHP time zone setting in php.ini directives

To change the PHP time zone setting in php.ini file
date.timezone = "Europe/Paris"

To change the maximum upload file size for PHP in php.ini directives

In php.ini file change below this,
upload_max_filesize = 20M
post_max_size = 21M

To change execution time in php.ini directives

In php page change execution tin in php.ini file max_execution_time = 100;