Jump to content

COPY()


toter

Recommended Posts

i am having trouble with the copy function.

[code]
<?php copy('file.php','newfile.php');?>
[/code]
produces an error:

Warning: copy(newfile.php): failed to open stream: Permission denied in /home/cs115896/public_html/leaders/tod/copy.php on line 1

all my files and folders are set to 777.
does any 1 know why this is?

thanks in advanced,
TT
Link to comment
Share on other sites

The error says it all: "Permission denied". You do not have sufficient permissions to perform that action. Either you do not have read permissions on file.php or write permissions on newfile.php or the folder.

Edit: You need permissions on the folder as well. Try this command in the folder: [code]chmod 777 -R .[/code] (note the dot at the end)
Link to comment
Share on other sites

You might want to try this too:

[code]print "I am in directory " . getcwd() . "\n";
print "My uid is " . getmyuid() . "\n";
print getcwd() . " is " . (is_writable(getcwd()) ? "writable" : "not writable") . "\n";[/code]

It's possible that newfile.php exists and the permission problem is there..
Link to comment
Share on other sites

[quote author=btherl link=topic=112091.msg454806#msg454806 date=1161327648]
You might want to try this too:

[code]print "I am in directory " . getcwd() . "\n";
print "My uid is " . getmyuid() . "\n";
print getcwd() . " is " . (is_writable(getcwd()) ? "writable" : "not writable") . "\n";[/code]

It's possible that newfile.php exists and the permission problem is there..
[/quote]

ok i got this: (Censored:<username>)
I am in directory /home/<username>/public_html/leaders/tod My uid is 33300 /home/<username>/public_html/leaders/tod is not writable

so this means i cant write files to this folder via copy right?
Link to comment
Share on other sites

[quote author=Daniel0 link=topic=112091.msg454808#msg454808 date=1161327758]
If it is 777 then user, group and others all have read, write and execute permissions on the file, so it should obviously be writeable. Try to open it with fopen and see if it is possible.
[/quote]

k
tried this:
[code]<?php fopen("file.php", "r");?>[/code]

got no errors
Link to comment
Share on other sites

Then try opening it with the w flag.

Also try to run this file: [code]<?php
header("Content-type: text/plain");
system('ls -l ..',$result);
echo $result;
?>[/code] It should give you some rows like this: [code]drwxrwxrwx 49 www-data www-data 4096 Oct 19 15:16 www[/code]

Paste it here.
Link to comment
Share on other sites

[quote author=Daniel0 link=topic=112091.msg454805#msg454805 date=1161327626]
Is safe-mode on?
[/quote]

ive tried this and it says no so safe-mode is off.
[code]<?php if(ini_get('safe_mode')){echo "yes";}else{echo "no";}?>[/code]

thanks everyone who has helped me out,
tt
Link to comment
Share on other sites

[quote author=Daniel0 link=topic=112091.msg454814#msg454814 date=1161329254]
Then try opening it with the w flag.

Also try to run this file: [code]<?php
header("Content-type: text/plain");
system('ls -l ..',$result);
echo $result;
?>[/code] It should give you some rows like this: [code]drwxrwxrwx 49 www-data www-data 4096 Oct 19 15:16 www[/code]

Paste it here.
[/quote]
this is what i got: (Censored: <username>)
[code]
<br />
<b>Warning</b>:  system() has been disabled for security reasons in <b>/home/<username>/public_html/leaders/tod/copy.php</b> on line <b>3</b><br />
[/code]
Link to comment
Share on other sites

you know the strange thing is that when i tried this before i used ftp url in the copy function. it worked only few times then pages started being blank. i thought maby too many ftp connections were being made?

wierd
well probally will have to talk to my providers.


thanks every 1,
TT
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.