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
https://forums.phpfreaks.com/topic/125959-php-rename-problems-please-help/
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);

Archived

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

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