Jump to content

Archived

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

joshuadbooth

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

Recommended Posts

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.
[code]<?php
$folder= $_POST['folder'];
$filename = "folders.xml";
$fh = fopen($filename, "w") or die("can't open file");
fwrite($fh, $folder);
fclose($fh);
?>
[/code]

Share this post


Link to post
Share on other sites
[code]
<?php
echo(is_writeable("folders.xml"));
[/code]
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.