user2767700
user2767700

Reputation: 41

Changing the location of the PHP error log file

I use PHP version 5.3.19, Windows Server 2008 R2 Standard SP 1 and Internet Information Services (IIS) 7.5.7600.16385.

My problem:

I can't change the PHP error log file location. When I try that and restart the IIS service, my web application cannot be opened:

Browser says 500 - Internal server error.

I tried everything.

I checked the error logs of Windows and the IIS error log. Nothing! Is this possible?

I was able to change the locations of the PHP session data folder and the PHP upload temp folder, no problem. (I created a folder, C:\myapplication\mycompany\temp, and gave this new folder all the necessary rights, so the IIS IUSR can do everything.)

So: The new locations of the PHP session data folder and PHP upload temporary folder work after restart of the IIS service! That's fine!

But I cannot change the location of the PHP error log file. Why? It is the same new Windows folder having the ultimate rights.

I tested a little bit with different text files. I created new and empty log files, tested with the original PHP error log file from C:\Windows\Temp. Nothing. And I really restarted the IIS service after every change of the php.ini file. But in the end: The browser says 500 - Internal server error when browsing the web application.

So, what can I do? I don't understand what's wrong.

Upvotes: 2

Views: 5516

Answers (1)

ffflabs
ffflabs

Reputation: 17481

You may be setting the error logs in file php.ini.

Try setting it at runtime with something like:

ini_set('display_errors', 'on');
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
ini_set('error_log', "C:\php\error.log");

That way, you should see the error message on screen, it there is one.

Upvotes: 3

Related Questions