Permission denied writing files FastCGI in Plesk virtual server

1.3k views Asked by At

I'm running a website on a virtual server under Plesk v10.4. I've changed PHP mode from Apache module to FastCGI for some subdomains. It works all ok, but error log shows me there are some permission problems when the application tries to write some data to a file.

The error log shows:

mod_fcgid: stderr: PHP Warning:  file_put_contents(/var/www/vhosts/XXXXX/file.txt): failed to open stream: Permission denied in /var/www/vhosts/XXXXX/XXXX.php on line 116

I changed permissions of /var/www/vhosts/XXXXX/file.txt to 777 and it solved the problem, but I think it isn't the right way to get it work. The file should be created by the application. All files in the directory has owner:group to www:www-data, so I don't know if default mod_fcgid owner:user is set up correctly.

Any idea on how to fix it?
Thanks in advance

1

There are 1 answers

2
IgorG On

The issue is caused by a "safe_mode = on" setting. Some php applications requires safe_mode to be off.