my project directory is /public_html/test/
ownership and permission are as below,
drwxrwsr-x 8 lamp apache 4096 Apr 8 10:46 public_html
drwxrwsr-x 6 lamp apache 4096 Apr 2 14:58 test
a web application create directory, upload some files, move files from one directory to other directory under directory /public_html/test/files/
drwxrwsr-x 21 lamp apache 4096 Apr 24 13:58 files
now the problem is, I created directory called "mydirectory" using web application, it created under /public_html/test/files/ as below,
drwxrwsrwx 2 apache apache 4096 Apr 15 13:56 mydirectory
then I uploaded one file say "myfile.jpg", which by default get uploaded to /public_html/test/files/
-rwxrwxrwx 1 apache apache 595284 Apr 15 13:58 myfile.jpg
then my code use php function "move_uploaded_file" to move file to /public_html/test/files/ to /public_html/test/files/mydirectory/ as below
move_uploaded_file('/public_html/test/files/myfile.jpg', '/public_html/test/files/mydirectory/myfile.jpg');
It doesn't work. how to fix this?
if I change ownership of /public_html/test/files/mydirectory/ to lamp:apache instead apache:apache, and then upload the file again, move_uploaded_file works fine.
note: user "lamp" belongs to "apache" group.
===================
PHP Safe_mode was ON, just made it OFF and it worked :)