Laravel 4: Failed to open stream: Permission denied

前端 未结 6 1830
南笙
南笙 2020-12-02 09:37

I\'m having problem in setting up Laravel 4. I\'m having this error when opening the index page:

file_put_contents(/Users/laravel/app/storage/meta/ser

6条回答
  •  暖寄归人
    2020-12-02 09:50

    It's better that you do not change the permissions, you should just change the owner:group of the storage folder to that of the owner:group of apache by using chown, this is more complicated but is more secure and you'll get used to this soon, you can find this in the httpd.conf

    MAMP:

    /Applications/MAMP/conf/apache/httpd.conf
    

    XAMMP:

    /Applications/XAMPP/xamppfiles/etc/httpd.conf
    

    Open the httpd.conf with your preferred editor then search for User/Group. After searching you will see these lines below that highlighted line you searched:

    User someuser
    Group somegroup
    

    Once you already know the User and Group, cd to your laravel directory then, do the chown:

    chown -R someuser:somegroup app/storage
    

    P.S: If you get permission something error upon doing chown, try this:

    sudo chown -R someuser:somegroup app/storage
    

    It will then ask for your password so input it then done.

提交回复
热议问题