move_uploaded_file gives “failed to open stream: Permission denied” error

前端 未结 13 2177
攒了一身酷
攒了一身酷 2020-11-22 05:36

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:

upload_tmp_dir = /var/www/ht         


        
13条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 06:07

    I ran into this related issue even after having already successfully run composer. I updated composer, and when running composer install or php composer.phar install I got:

    ...failed to open stream: Permission denied...

    It turns out after much research that the previous answers regarding changing permissions for the folder worked. They are just slightly different directories now.

    In my install, on OS X, the cache file is in /Users/[USER]/.composer/cache, and I was having trouble because the cache file was owned by root. Changing ownership of '.composer' recursively to my user solved the issue.

    This is what I did:

    sudo chown -R [USER] cache
    

    Then I ran the composer install again and voila!

提交回复
热议问题