Hello,
I have a very strange error. I recently installed a test environment on my laptop with IIS7/PHP5/MySQL on Vista Home Premium. When I tried to install phpMyAdmin I found that it somehow failed silently, in particular, config file could not get written even though no error was shown. To simplify the situation I set permission as Full Control for Everybody on wwwroot. As I investigated further I found that for some reason when a stream was open the actual file was not written on the disk. For example, the following code
<?php
$fout=fopen('Test.html','w');
echo($fout);echo("<br>fprintf = ");
echo(fprintf($fout,'Hello world'));echo("<br>");
echo(fclose($fout));echo("<br>");
echo($fin=fopen('Test.html','r'));echo("<br>fscanf = ");
echo($ftext=fgets($fin));echo("<br>");
echo(fclose($fin));echo("<br>");
echo(getcwd());
?>
Produces output
Resource id #2
fprintf = 11
1
Resource id #3
fscanf = Hello world
1
C:\inetpub\wwwroot
However, if I navigate to the directory
the Test.html does not exist.
When I modified the code to be
<?php
try{
$fout=fopen('Test.html','w');
echo($fout);echo("<br>fprintf = ");
echo(fprintf($fout,'Hello world'));echo("<br>");
echo(fclose($fout));echo("<br>");
echo($fin=fopen('Test.html','r'));echo("<br>fscanf = ");
echo($ftext=fgets($fin));echo("<br>");
echo(fclose($fin));echo("<br>");
echo(getcwd());echo("<br><br><b>Contains:</b><br><br>");
$handle = opendir('.');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo ($file);
echo("<br>");
}
}
closedir($handle);
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
The file appeared in the directory. When I moved helloWorld.php (the php file I was using for testing) to phpMyAdmin folder I got wrong address error, but when I removed index to browse all files in folder I found it. Once I saw it in the folder it ran fine even after I returned the index. phpMyAdmin configuration still doesn't work though (file doesn't get written).
This makes me think there is some weird cache problem.. but I can't figure out how I can fix it. I looked at IIS manager and nothing jumps out.