) Set the Log Level in PHP using the. htaccess File

Source: Internet
Author: User
Tags php error php error log

Introduction: This is a detailed page for setting the log level using the. htaccess file in PHP. It introduces the related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 334786 'rolling = 'no'>
In PHP, you can use the. htaccess file to set the log display level, for example

Disable Error display:

Php_flag display_startup_errors off

Php_flag display_errors off

Php_flag html_errors off

Php_value docref_root 0

Php_value docref_ext 0 only displays PHP errors:

Php_flag display_errors on

Php_flag display_startup_errors on

Php_value error_reporting 2047 where "2047" is the level of the error to be displayed. The detailed table is as follows:

1 e_error

2 e_warning

4 e_parse

8 e_notice

16 e_core_error

32 e_core_warning

64 e_compile_error

128 e_compile_warning

256 e_user_error

512 e_user_warning

1024 e_user_notice

2047 e_all

2048 e_strict

4096 to save the error to the log file, you can set it as follows:

# Enable PHP error logging

Php_flag log_errors on

Php_value error_log/home/path/public_html/domain/php_errors.log then, you can set that access to the. log file is not allowed:

# Prevent access to PhP Error Log

<Files php_errors.log>

Order allow, deny

Deny from all

Satisfy all

</Files> set the maximum size of the Error Log, in bytes:

# General directive for setting max error size

Log_errors_max_len INTEGER:

# PHP error handling for production servers

# Disable display of startup errors

Php_flag display_startup_errors off

# Disable display of all other errors

Php_flag display_errors off

# Disable HTML markup of errors

Php_flag html_errors off

# Enable logging of errors

Php_flag log_errors on

# Disable ignoring of repeat errors

Php_flag ignore_repeated_errors off

# Disable ignoring of unique source errors

Php_flag ignore_repeated_source off

# Enable logging of PHP memory leaks

Php_flag report_memleaks on

# Preserve most recent error via php_errormsg

Php_flag track_errors on

# Disable formatting of error Reference Links

Php_value docref_root 0

# Disable formatting of error Reference Links

Php_value docref_ext 0

# Specify path to PhP Error Log

Php_value error_log/home/path/public_html/domain/php_errors.log

# Specify recording of all PHP errors

Php_value error_reporting 999999999

# Disable max error String Length

Php_value log_errors_max_len 0

# Protect error log by preventing public access

<Files/home/path/public_html/domain/php_errors.log>

Order allow, deny

Deny from all

Satisfy all

</Files> The following settings are suitable for developers:

# PHP error handling for Development servers

Php_flag display_startup_errors on

Php_flag display_errors on

Php_flag html_errors on

Php_flag log_errors on

Php_flag ignore_repeated_errors off

Php_flag ignore_repeated_source off

Php_flag report_memleaks on

Php_flag track_errors on

Php_value docref_root 0

Php_value docref_ext 0

Php_value error_log/home/path/public_html/domain/php_errors.log

Php_value error_reporting 999999999

Php_value log_errors_max_len 0

<Files/home/path/public_html/domain/php_errors.log>

Order allow, deny

Deny from all

Satisfy all

</Files>

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/334786.html pageno: 10.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.