Jump to content

php rename() problems, please help!


tx647

Recommended Posts

Hi there,

 

I'm new here, and I got questions about the rename() function. Have been searching on Google for a while, but never got any luck.

 

So, I have a script to move a file to another directory upon question. The syntax I'm using is rename($oldfile, $newfile). The old file resides in /usr/foo/, and I'm moving it to /usr/foo/trash/. I have changed the owner and group of both foo and foo/trash to apache. And to make it easy, I changed permissions of the file, foo and foo/trash directories all to 777. But the rename function always fails (checked many times my spelling and printed out the command query to double check).

 

Also, there's another part to this problem. To test, I tried to do this same operation in /var/www/html directory. The problem is, rename() works on small files, but never on big ones (any thing bigger than 50M or so). I didn't think it was the problem, but I changed the php script memory limit environment variable to 200M. It didn't help at all any way.

 

Any help would be greatly appreciated!

 

xt

Link to comment
Share on other sites

When learning php, developing php code, or debugging php code, always set error_reporting to E_ALL and set display_errors to ON to get php to help you. Add the following two lines immediately after your first opening <?php tag -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

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.