FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


File Permissions Writing/Reading





chasbeen
Hello my PHP script is generatring "Please Wait
Warning: copy(copiedhtml.txt) [function.copy]: failed to open stream: Permission denied in /home/?????????/domains/?????????.frih.net/public_html/ppc/?????????.php on line 13
failed to copy $filename...

I know where this is coming from but I see I have the followwing permissions on the file i'm trying to copy:

-rw-r--r-- 1 ftp ftp 23419 Jan 14 02:24 pcostals.html

In my ftp software (core lite) I have a menu option called custom commands and tried to
"chmod 777 pcostals.html"

How do I open files for writing on my part of the server?

Thanks
rvec
I think you made a typo in your php file. copiedhtml.txt is not the same as copied.html Wink

If you change that on line 13 in your php file I think everything should be working.
chasbeen
The code works fine on my local webserver. It's pretty basic and reads as follows

$filename = $_POST[userId] . '.html';
$newfilename = 'copiedhtml.txt';
if (!copy($filename, $newfilename))
{
echo 'failed to copy $filename...';
}
else

I'm certain it's file permissions.
rvec
yeah but you use copiedhtml.txt in this file and have given copied.html the permissions. On a windows pc this won't make a problem because you made the file and you have enough permissions to make the copiedhtml.txt. But on the frihost server you ask apache to make the file and apache doesn't have the permission to do that. So it gives the error.

In short, change the script. Instead of copiedhtml.txt make it edit copied.html .
chasbeen
rvec
thanks for the effort.
I did not have "write privilidges" on the folder to create new files. I used the Filemanager interface and changed the permission. The code works okay now.
rvec
you know you have 2 different files now?
chasbeen
I'm doing the tredious part (Testing) and all looks good. Hope all is well in Europe.
Related topics
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.