简体   繁体   中英

PHP / Unix - Unable to write to a file (permission denied - fopen)

I have a simple problem that has me confused. I'm trying to write to a file using PHP fopen but I'm getting the error

"Warning: fopen(/var/www/********/file.php): failed to open stream: Permission denied in /var/www/********/index.php on line 339 

The file (and directory) that I am trying to write to (file.php) has 777 permissions and is chowned to same user as index.php.

Any ideas what the problem could be?

The problem was related to SELinux. I needed to run the following command:

setenforce permissive

Files are now writeable without issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM