http://stackoverflow.com/questions/8103860/move-uploaded-file-gives-failed-to-open-stream-permission-denied-error-after
I keep getting this error when trying to configure the upload directory with Apache 2.2 and PHP 5.3 on CentOS.
In php.ini:
In httpd.conf:
CentOS directory permissions:drwxrwxr-x 2 root root 4096 Nov 11 10:01 images drwxr-xr-x 2 root root 4096 Nov 12 04:54 tmp_file_uploadNo matter what I do, I keep getting this error from PHP when I upload the file: Warning: move_uploaded_file(images/robot.jpg): failed to open stream: Permission denied in /var/www/html/mysite/process.php on line 78As you can see it never did take the configuration from the php.ini file regarding the upload file. What am I doing wrong here? |
|||||||||
|
This is because
images and tmp_file_upload are only writable by root
user. For upload to work we need to make the owner of those folders
same as httpd process owner OR make them globally writable (bad
practice).
|