Ravel, PHP gets Operation not Permitted error when using chmod method

Asked 2 years ago, Updated 2 years ago, 39 views

I am currently implementing scraping in Ravel, but when I moved from the local environment to the staging environment, I received the error failed to open stream: Permission denied for the file_put_contents method.

So when I added the chmod method to the process to change the write permissions of the file, I got the error chmod(): Operation not permitted.How can I solve this problem?

php laravel

2022-09-29 22:16

1 Answers

When you write a file, change the owner and permissions of the directory to which you want to put the file as follows:

chown apache: apache/var/www/service/approot/(saveDirectory)
chmod777/var/www/service/approot/(saveDirectory)

(Of course, permissions and users vary slightly depending on the environment.If it's a shared server, it might be ftp user name.)


2022-09-29 22:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.