file_put_contents - failed to open stream: Permission denied

前端 未结 14 1690
耶瑟儿~
耶瑟儿~ 2020-11-27 03:05

I am trying to write a query to a file for debugging. The file is in database/execute.php. The file I want to write to is database/queries.php.

14条回答
  •  臣服心动
    2020-11-27 03:27

    Gathering info from this link stackoverflow-image save doesn't work with chmod 777 and from user azerafati and Loek Bergman

    if you were to look under /etc/apache/envvars file you will see something like:

    export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data
    

    Apache is run under the username 'www-data'

    '0755' means the file owner can read/write/execute but group and other users cannot write. so in ur terminal, cd to the folder containing your 'images' folder. then type:

    find images -type d -exec chmod 0755 {} \;
    find images -type f -exec chmod 0755 {} \;
    sudo chown -R www-data:www-data images
    

    you must change persmissions first before changing owner. enter your password when prompted. this will make 'www-data' owner of the images folder.

    your upload should now work.

提交回复
热议问题