phpmove-uploaded-file

Permission denied issue while using move_uploaded_file()


I am getting below error:

PHP Warning: move_uploaded_file(PATH_TO_FILE): failed to open stream: Permission denied in PHP_FILE

Note: I have already executed sudo chown -R apache *PATH_TO_FOLDER*. OS: Fedora 33 (Workstation Edition), PHP ver. 7.4.14.

Thanks in advance.


Solution

  • Turns out SELinux was the problem. Solved it by executing semanage permissive -a httpd_t.