I know this is a common bug with many threads but I\'m tired of searching and I still haven\'t solved it. When I try to run the function file_put_contents I get
chcon -Rv --type=httpd_sys_rw_content_t /dir
This may help,rather than turn off the selinux.
Ok, I found the issue: selinux
Here's the solution: http://kb.sp.parallels.com/en/11142
In case the page goes down:
Symptoms
After you change the default directory to store website content (say, to "/home"), you are unable to access the content of subdomains and additional websites over the Web.
Cause
This problem occurs if SELinux works in "Enforcement" mode. In this mode, webroot directories for websites and subdomains inside them have different permissions, and your web server fails to access them. Run this command:
# getenforce
The output should be: Enforcing
Resolution
Disable SELinux support: Open the file /etc/selinux/config in any editor and find this row:
SELINUX=<value>
Change it to:
SELINUX=disabled
If you cannot find this file, open the file /boot/grub/grub.conf in any editor and add the parameter selinux=0 to the Grub Boot Loader:
title SE-Linux Test System
root (hd0,0)
kernel /boot/vmlinuz-2.4.20-selinux-XXXXXXXXXX ro root=/dev/hda1 nousb selinux=0
#initrd /boot/initrd-2.4.20-selinux-XXXXXXXXXX.img
Reboot the server to apply the changes. If you do not want to reboot, run this command:
# setenforce 0