Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use error_log() function in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 135
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to use error_log() function in php ?

    The error_log() function is used for sending an error message to a log, to a file, or to a mail account.
    The error_log() function always returns TRUE on success or FALSE on failure.

    syntax of error_log() function

    error_log(message,type,destination,headers);
    

    "message" is a required parameter
    "type" is a optional parameter
    "destination " is a optional parameter
    "headers "is a optional parameter

    you can see bellow example:

    <?php
    
    // Send a error message to the server log if error connecting to the database
    if (!mysqli_connect("localhost","usrname","password","database")) {
      //here call error_log()
        error_log("Failed! unable to connect to database!", 0);
    }
    
    ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: