File not writeable even though permissions are 777

2019-02-21 20:01发布

问题:

Something really weird is going on.

httpd.conf says apache runs as the apache user.

I have chown-ed the files to be apache:apache.

The file is still not writeable.

I have set the permissions (of the entire webroot as a last resort) to be 777 and the file is still not writeable...

The path is correct because file_exists() is true but is_writeable is false.

Any ideas?

回答1:

It's more than possible that you have SELinux running on the machine. To check whether it's running or not you should be able to run the getenforce command on the commandline. If it returns "Enforcing" then SELinux is enabled and running in enforcing mode.

I'd suggest that in most cases (unless you want to spend days learning about SElinux) that you disable it by running setenforce Permissive and editing /etc/sysconfig/selinux so that next time the server restarts it won't reactivate it.

If you're sure you don't need SELinux you could just remove the packages from the server



回答2:

Maybe you are root on vserver only? Do you have own server or do you have only host> If you have only host (not whole machine) than often you can't run vmstat or edit file of sysctl .

Second option is SELinux. Run getenforce. If it returns enforcing than you should run setneforce Permissive. This dissable SELinux