Here be my snippet. No matter the path descriptor, it won't open. fopen() is enabled - confirmed via phpInfo. Error output below code.
Code: Select all
<?php
// $filename = "C:\\website\\slides\\05B.php"; // this works for (a) and (b)
// $filename = "./05B.php"; // this works for (a) and (b)
// $filename = "../slides/05B.php"; // this works for (a) and (b)
$filename = "../slides/05B.php";
chmod ($filename, 777); // (a)
if (file_exists($filename)) { // (b)
echo "<br>it's there<br>";
} else {
echo "<br>it ain't there<br>";
}
$handle = fopen($filename, “r”); // (c) always fails
fwrite($handle, 'Yo, sup?'); // (d) always fails
fclose($handle); // (e) always fails
?>it's there
Warning: fopen(../slides/05B.php) [function.fopen]: failed to open stream: No such file or directory in C:\website\slides\publisher_rhp.php on line 79
Warning: fwrite(): supplied argument is not a valid stream resource in C:\website\slides\publisher_rhp.php on line 80
Warning: fclose(): supplied argument is not a valid stream resource in C:\website\slides\publisher_rhp.php on line 81
I'm not terribly experienced with php, but I'm not at all new to app servers either...
thanks for your consideration,
Elwoody