简体   繁体   中英

php error_log not working in local environment

I'm running copy of PHP as a local server under Windows 10. 在此处输入图像描述

I have got a simple test script "t.php":

error_log('one');
ini_set('error_log', 'ttt.log');        // may be also absolute path like c:\ttt.log - does not work either 
error_log('two');
echo 't';

After running that script the second message is sent "to nowhere" - there is no file with the message 'two'.

在此处输入图像描述

Any help, how to get the second message in error_log file?

Finally I found what's been wrong. The problem was caused by Windows 10 file security system, not PHP itself. Oryginally I started PHP program from.BAT file. PHP had no permission to write to any file, so all attempts to write a log file were silently discarded by Windows. After running PHP from.LNK file (shortcut to original file) and assigning administrator privileges in that file - the problem disappeared.

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