简体   繁体   中英

PHP error_log only working on select scripts

Setup

  • IIS 8.5 on Windows 2012 Server
  • PHP manager
  • PHP 5.5
  • log_errors set to on in php.ini file

I have used PHP manager to select my log file and I have a few scripts in my application where error_log() works as expected. However any of the new scripts I have created I cannot get any input into the log file by means of error_log().

Another weird problem is one of the scripts that has error_log() working has a few send notification functions that error_logs the users being notified etc. This all works fine if the script is ran directly but if I try to include this script in another file to utilize my notifications functions even though the functions are executing properly I know longer have any of the error_log messages in that function.

I've even tried adding

error_reporting(E_ALL); 
ini_set('display_errors', 0); 
ini_set('log_errors', 1); 
ini_set('error_log', 'c:\Windows\Logs\PHP\php.log'); 

directly in the php files I want logging on and still get nothing.

disabling error_logging in php.ini then re-enabling it and also providing the path to a new log file in the inetpub/temp/ directory did it. (Previously it was in C:/Windows/logs/PHP)

I did realize that the only scripts that where logging errors where the ones that where being executed by task scheduler. I'm not sure if the cron job is run as system and IIS or php as another user without write access to that folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM