Jump to content

Help a Noob - fopen() problem


peted

Recommended Posts

Hi -

I'm having an issue with fopen, in that it doesn't work for the following code:

<?
mkdir("/data/websites/www/about/try/", 0777);
$fp = fopen("/data/websites/www/about/try/test.php", "w");
fwrite($fp, "test");
fclose($fp);
?>

 

the mkdir works fine and creates the folder, but the file "test.php" is not created.

 

Any ideas?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/42663-help-a-noob-fopen-problem/
Share on other sites

$fp = fopen("/data/websites/www/about/try/test.php", "w+");
fwrite($fp, "test");
fclose($fp);

 

Adding the plus should create the file, without the plus it assumes y ou are trying to open an existing file where if you just made the directory I bet it is empty.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.