Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP error log on IIS does not write to file

I am using an IIS 7.5 on Windows Server 2008 R2 together with PHP 5.5 NTS via FastCGI. Somehow my PHP does not want to log errors to a file. The file never gets created and when I create it manually, PHP does not write into it.

This is my php.ini (verified, that it's the one that gets loaded with phpinfo(); )

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
log_errors = On
error_log = "C:\inetpub\logs\php\php_errors.log"

The specified directory has write access for IIS_IUSRS, IUSR and even the AppPool User (yes I know its redundant, just to make sure). I even turned on display_errors to see if there is an error and it does display the error in my browser but PHP still doesn't want to write an error log.

Edit: [SOLVED]

I was using BasicAuthentication for my website and there the IIS impersonates the user you are logging in with. Therefore I just added my log on user account to the IIS_IUSRS group and now it works.

like image 840
Saenic Avatar asked Jul 20 '13 18:07

Saenic


People also ask

How do I log errors to a text file in PHP?

The ini_set(“log_errors”, TRUE) command can be added to the php script to enable error logging in php. The ini_set('error_log', $log_file) command can be added to the php script to set the error logging file. Further error_log($error_message) function call can be used to log error message to the given file.

Where does PHP Error_log go?

The location of the error log file itself can be set manually in the php. ini file. On a Windows server, in IIS, it may be something like "'error_log = C:\log_files\php_errors. log'" in Linux it may be a value of "'/var/log/php_errors.


1 Answers

Adding this as a solution text so that it no longer appears on the Unanswered questions list. Answer is provided by question author in the edited question above:

Edit: [SOLVED]

I was using BasicAuthentication for my website and there the IIS impersonates the user you are logging in with. Therefore I just added my log on user account to the IIS_IUSRS group and now it works.

like image 188
Jared Clemence Avatar answered Oct 23 '22 17:10

Jared Clemence