How do I log errors and warnings into a file?

前端 未结 7 1361
感动是毒
感动是毒 2020-11-22 04:43

How do I turn on all error and warnings and log them to a file, but to set up all of that within the script (not changing anything in php.ini)?

I want to define a fi

7条回答
  •  伪装坚强ぢ
    2020-11-22 04:54

    add this code in .htaccess (as an alternative of php.ini / ini_set function):

    
    php_flag log_errors on 
    php_value error_log ./path_to_MY_PHP_ERRORS.log
    # php_flag display_errors on 
    
    

    * as commented: this is for Apache-type servers, and not for Nginx or others.

提交回复
热议问题