Mostafa Talebi
Mostafa Talebi

Reputation: 9173

PHP permission error on writing to a file in Linux CentOS

I have installed linux centos 7 on a VmWare in Windows.

There are two users in the linux: root, sample

I have created a laravel project with user "sample" (logged in as sample), but when I try to run the project with user root (logged in as root), it throws a permission error that cannot write to the file (file_put_content()). I have tried

chmod 777 /var/www/html/laravel

Or even I have tried to change the permission of the write-access of the file to root using right-click->properties->permission, but to no avail.

The only possible solution has been to delete the file and re-create it with user root. Now, what is the solution? I though user root is privileged to do anything. But it seems it is not the case. What is the solution? How should change this issue?

Upvotes: 0

Views: 893

Answers (1)

Robert Gabriel
Robert Gabriel

Reputation: 1190

Try chmod 777 -R /var/www/html/laravel/ ,-R is recursive

Upvotes: 2

Related Questions