Getting over the "The page cannot be displayed because an internal server error has occurred." without any option to enable error reporting
<p>I have a really stupid problem and I have no idea how to solve it. One of my clients wanted me to put a simple PHP script on his website, which is hosted on a Windows/PHP shared hosting.</p>

<p>The problem is, that they have error reporting disabled and I don't have access to error logs. The only thing that I'm getting is</p>

<pre><code>The page cannot be displayed because an internal server error has occurred.
</code></pre>

<p>I've tried</p>

<pre><code>&lt;?php
error_reporting(E_ALL);
ini_set('display_errors','On');

foreach(1 as $i);
?&gt;
</code></pre>

<p>but it doesn't change anything, I'm still getting generic 500 error. Is there any other way to make PHP display error messages? The hosting tech support is completely non-responsive, but I'd like to solve this somehow, even with some hackery, which means I don't care how dirty the solution is, all I care about is that I can see the error message in detail.</p>

<p><a href="http://shalamarrestaurant.cz/info.php" rel="nofollow"><strong>Here's a link to the <code>phpinfo();</code> call</strong></a></p>

<p><strong>edit</strong>: I tried to add custom error handler as you guys suggested, but I'm still getting the 500 page and no error log written</p>

<pre><code>&lt;?php
date_default_timezone_set("Europe/Prague"); // tried commenting this line out, didn't help

function fileLogHandler($errno, $errstr, $errfile, $errline) {
    $logFile = "error.log";
    $f = fopen($logFile, "a") or die("Couldn't open log file for write");
    fwrite($f, strftime("%c") . " $errstr on line $errline\nin file $errfile\n\n");
}

set_error_handler("fileLogHandler");

foreach(1 as $i);
?&gt;
</code></pre>

<p>When I execute this on my local machine, it works as expected</p>

<pre><code>$ php -f test.php  &amp;&amp; cat error.log 
Fri Oct 28 15:40:14 2011 Invalid argument supplied for foreach() on line 12
in file /Users/darth/Sites/shalamar/test.php
</code></pre>

<p>but it doesn't work on the host machine ...</p>

<p>I tried to dumb down the whole script to </p>

<pre><code>&lt;?php
$logFile = "error.log";
$f = fopen($logFile, "a");
fwrite($f, "Hi");
?&gt;
</code></pre>

<p>and ended up realizing, that I probably don't have write permissions to the folder. The problem is, it's a windows server, and if I try to change permissions via FileZilla, I get the lovely</p>

<pre><code>Command:    SITE CHMOD 666 error.log
Response:   500 'SITE CHMOD 666 error.log': command not understood
</code></pre>

<p><strong>I tried to google around and it looks like I can't set file permissions via FTP.</strong></p>

<p>Sending the log over email also ends up in 500 error</p>

<pre><code>mail("mysecret@email.com", "Voice of desperation");
</code></pre>

<p>Any suggestions now?</p>

<p><strong>edit2:</strong> Thanks for all the suggestions so far, but I found out I don't even have access to the filesystem, so I can't write to a log file. At least that's what it looks like, so I talked to the tech support guys, and they say they'll look into it within the next week ... yay </p>
