Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Okay, this is slowly getting annoying. I'm used to work with Apache Webservers and never had any of these problems. IIS seems to try to be intelligent - or whatever.

Here's my situation: My customer wants a PHP website and it is supposed to run on an Windows IIS webserver.

For my development environment I could use my Apache - but just to be sure I want to do it with IIS, too. So I set up a dev-server with Windows Vista, all the latest Updates and installed IIS. Everything fine!

I quickly found instructions on how to install PHP in IIS on some official Microsoft site. Modified php.ini - have been doing stuff like that for years on Linux/Apache machines.

So now I have a Server to run IIS on and my workstation which I use to develop, accessing the files on the server over network.

My first "phpinfo()" page - everything okay. Now I intentionally break the page by introducing a bug: All I get on my workstation is "Server Error 500". When I access the page directly on the server I see an PHP error message... Well, got that worked out with this serverfault.com question.

BUT: It still keeps annoying me: Now if there is an error all I get is JUST the error message. I don't see any of the other output of the script. In fact in Firefox I don't see anything at all in case of an error.

For example if I do this...

<?PHP 
$sql = 'THIS WON\'T WORK';
echo $sql;
$DB->exec($sql);  // <- This causes an error
?>

all I get is

PHP Fatal error:  Call to a member function exec() on a non-object in C:\inetpub\wwwroot\phpinfo.php on line 4

What I actually want is that it shows me the output of everything that happened before the error so that I can use that to fix my problem.

How do I get IIS (or PHP?) to show me everything? Error message AND context? Over the network?

Update

Okay, I may have a lead. When I go to my console and call my script manually via php-cgi.exe this is what I get:

PHP Fatal error:  Call to a member function exec() on a non-object in C:\inetpub
\wwwroot\phpinfo.php on line 4
X-Powered-By: PHP/5.4.12
Content-type: text/html

THIS WON'T WORK<br />
<b>Fatal error</b>:  Call to a member function exec() on a non-object in <b>C:\i
netpub\wwwroot\phpinfo.php</b> on line <b>4</b><br />

I then tried to pipe the output to a files and figured out that the first two lines are piped to stderr and the rest goes to stdout (Read here for more info about that).

I can also see that what I get in my browser is the output to stderr, because it does not contain any HTML formatting.

I can now narrow my question down to this: I have a FastCGI PHP-CGI that outputs an error message to stderr and the page causing the error to stdout. It currently forwards stderr to the browser - how do I get it to use stdout instead?

share|improve this question

1 Answer 1

... and finally I got it working.

Based on my stderr findings I did some more googling and found this document about "Secure PHP with Configuration Settings" on IIS.net.

I have an dev machine, so I don't really need to get it bullet proof, but it still had my solution:

fastcgi.logging=0

Put this in your PHP.INI and PHP will stop sending stuff to stderr - et voila: I get my usual PHP output in my browser window!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.