Jump to content


Photo

MacOS, Permissions, local Apache servers, headaches, etc.


  • Please log in to reply
3 replies to this topic

#1 joshuadbooth

joshuadbooth
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 13 July 2006 - 06:13 PM

Ok... here's the setup

I'm on a Mac Powerbook with OS 10.4 with php enabled in the local webserver. I can go to http://127.0.0.1/phptests and successfully run php files. Here is my dilemma: I'm trying to get a phpscript to write to a local file using fwrite("folders.txt", $folder); The problem is it always gives me an error, saying it can't write to the file. I have absolutely no idea what to do now. If I upload all the necessary files to the web, it works fine. I tried entering a chmod command but it won't let me do that. Any suggestions on how to get this to work locally?

here's my code:  the $folder variable gets its info from a flash movie, and works correctly. It just won't write locally.
<?php
$folder= $_POST['folder'];
$filename = "folders.xml";
$fh = fopen($filename, "w") or die("can't open file");
fwrite($fh, $folder);
fclose($fh);
?>


#2 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 13 July 2006 - 09:56 PM

<?php
echo(is_writeable("folders.xml"));
Tell us the result, if it's 1 then the file should be able to be written to, if nothing is displayed then proper permissions are not there.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#3 joshuadbooth

joshuadbooth
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 13 July 2006 - 10:13 PM

that's the problem... it's registering a 0 for is_writable when on my local host, and 1 when it's on the remote host. I need to figure out how to get it to work on the local host.

#4 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 13 July 2006 - 10:15 PM

I know nothing about Mac, can you access the folder/file visually and see if there's a Read-Only or equivalent setting. Sometimes I had the problem on my local Windows install and so I found it was set Read-Only.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users