2

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Hi, right: I did it in php.ini. The default value after installing php on iis/windows server was "C:\Windows\Temp". It's terrible, isn't it? I would like to move the log file into another folder, my own folder, where ich can change the IUSRs rights.
fantastic, help me troubleshoot an odd error on code that had been running over 4 years.
@peter-mortensen thanks for "improving" my answer. Truth is I'm glad I wasn't kicked out back then. It's a poor answer and there's no rephrasing that can fix that.
I added this code to the start of the website PHP file, and it did nothing. I'm guessing it has to be added to the .htaccess file?
Nope. It's code for the start of the PHP file. But the pathname you give has to be a complete (absolute) pathname.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.