In my project I can't use move_uploaded_file
PHP function because of:
Notice: PHP Request Startup: file created in the system's temporary directory in Unknown on line 0
Warning: move_uploaded_file(../Pictures/1n0): Failed to open stream: Permission denied in /var/www/backend/Controllers/News.controller.php on line 114
move_uploaded_file(): Unable to move "/tmp/phpSPAnSj" to "../Pictures/1n0" in /var/www/backend/Controllers/News.controller.php on line 114
I tried to fix this problem by changing owner of /var/www/backend/Pictures
directory and permissions of this dir:
# ls -la /var/www/backend
:
drwxr-xr-x. 10 root root 4096 Oct 14 20:26 .
drwxr-xr-x. 8 root root 4096 Oct 18 12:18 ..
...
drwxr-xr-x. 2 nobody root 4096 Oct 13 14:45 Pictures
and also, I saw the permissions of /tmp
dir:
# ls -la /
:
drwxr-xr-x. 19 root root 4096 Oct 16 14:43 .
drwxr-xr-x. 19 root root 4096 Oct 16 14:43 ..
...
drwxrwxrwt. 14 root root 280 Oct 18 12:28 tmp
(I tried to change the directory of temp uploads by modifing php.ini
: upload_tmp_dir = /var/www/tmp_upload
but apache still keeps tmp files in /tmp
directory.)
So how can I give permissions to apache for moving temporary uploaded files?
nobody
?stackOverflow
?