Teach you how to open PHP's error_log log

Source: Internet
Author: User
Tags php programming
This article introduces, PHP open Error_log log method, have the need for friends, refer to it.

In PHP programming, for some access to the PHP page without obvious error hints, you can use Error_log to make further judgments. But for a variety of reasons, some servers do not have PHP error_log enabled.

Test or other needs, you can open the method as follows.

To edit php.ini, set Log_errors to On:

Log_errors = On

Then, restart Apache.

If successfully turned on, you can track the corresponding error prompt:

[Mon SEP 24 16:57:01 2012] [ERROR] [Client 218.5.80.210] PHP Warning:fsockopen () have been disabled for security reasons in/home/bccgi-bin/fsockopen.php on line 2

[Mon SEP 24 16:57:02 2012] [ERROR] [Client 218.5.80.210] PHP Warning:fsockopen () have been disabled for security reasons in/home/bccgi-bin/fsockopen.php on line 2

[Mon SEP 24 16:57:03 2012] [ERROR] [Client 218.5.80.210] PHP Warning:fsockopen () have been disabled for security reasons in/home/bccgi-bin/fsockopen.php on line 2

[Mon SEP 24 16:57:04 2012] [ERROR] [Client 218.5.80.210] PHP Warning:fsockopen () have been disabled for security reasons in/home/bccgi-bin/fsockopen.php on line

Also, note that in a Windows environment, in addition to setting log_errors to on, you need to define the path and file name of the Error_log:

Error_log = D:/temp/error.log

(This directory needs to be granted the PHP identity user's Modify permissions, otherwise the log file cannot be generated) IIS does not have the concept of error_log, so it needs to be defined separately.

Whether it is PHP programming, or system-based operations and so on, log files are very important, to develop the habit of collecting and analyzing logs, and sometimes to solve the problem to bring great help.

  • Related Article

    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.