)php中用.htaccess檔案設定日誌的層級

來源:互聯網
上載者:User

簡介:這是(轉)php中用.htaccess檔案設定日誌的層級的詳細頁面,介紹了和php,有關的知識、技巧、經驗,和一些php源碼等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=334786' scrolling='no'>
在php中,可以用.htaccess檔案去設定日誌的顯示層級,比如

關閉錯誤顯示:

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隻顯示PHP錯誤:

php_flag  display_errors        on

php_flag  display_startup_errors on

php_value error_reporting        2047其中,“2047”為要顯示的錯誤的層級,詳細表格如下:

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 E_RECOVERABLE_ERROR 要把錯誤儲存到記錄檔中,可以這樣設定:

# enable PHP error logging

php_flag  log_errors on

php_value error_log  /home/path/public_html/domain/PHP_errors.log然後,可以設定不允許訪問.log檔案:

# prevent access to PHP error log

<Files PHP_errors.log>

Order allow,deny

Deny from all

Satisfy All

</Files>設定錯誤記錄檔的最大體積,以bytes為單位:

# general directive for setting max error size

log_errors_max_len integer綜合上述,.htaccess的PHP錯誤顯示設定匯總:

# 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>以下則是適合開發人員應用的設定:

# 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>

愛J2EE關注Java邁克爾傑克遜視頻站JSON線上工具

http://biancheng.dnbcw.info/php/334786.html pageNo:10

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.