I installed apache
, MySQL
, PHP
in CentOS 7. All work well, except apache
cannot write file in html folder. I found this problem when I used file_put_contents
. I tried
- Change
owner
of/var/www
toapache:apache
, not work - Added
Order allow,deny
Allow from all
to<Directory "/var/www/html">
inhttpd.conf
, restarthttpd
service, not work chmod -R 0777 /var/www/html
, not work
What is wrong with my server? Please help me!
UPDATE1: result of ls -al /var/www/html
total 40 drwxrwxrwx. 5 apache apache 4096 Sep 23 10:19 . drwxr-x---. 4 apache apache 31 Sep 18 01:50 .. drwxrwxrwx. 15 apache apache 4096 Sep 23 08:43 folder1 drwxrwxrwx+ 10 apache apache 4096 Sep 23 10:19 folder2 -rwxrwxrwx. 1 apache apache 1574 Sep 5 08:55 favicon.ico -rwxrwxrwx. 1 apache apache 603 Sep 22 05:05 .htaccess -rwxrwxrwx. 1 apache apache 9841 Sep 8 08:34 index.php drwxrwxrwx. 8 apache apache 4096 Sep 23 08:44 folder3
UPDATE 2: apache error_log
(I changed all IP address) – Edited, change to new error_log, after stop httpd
, backup error_log, start httpd
[Thu Sep 24 07:06:47.540295 2015] [core:notice] [pid 14439] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0 [Thu Sep 24 07:06:47.541787 2015] [suexec:notice] [pid 14439] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Thu Sep 24 07:06:47.569389 2015] [so:warn] [pid 14439] AH01574: module rewrite_module is already loaded, skipping [Thu Sep 24 07:06:47.572287 2015] [auth_digest:notice] [pid 14439] AH01757: generating secret for digest authentication ... [Thu Sep 24 07:06:47.573315 2015] [lbmethod_heartbeat:notice] [pid 14439] AH02282: No slotmem from mod_heartmonitor [Thu Sep 24 07:06:47.600913 2015] [mpm_prefork:notice] [pid 14439] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations [Thu Sep 24 07:06:47.600943 2015] [core:notice] [pid 14439] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
Advertisement
Answer
Thank all guy! I fixed my problem with this guide:
http://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/
I hope it will be helpful.