I recent had this problem after a fresh install of EE. I read all the documentation on the topic and searched the forums.
I found this thread to be of use:
Unable to save your template as a text file
I thought the following may help other with a similar problem:
1) Safe Mode
You can check if your PHP installation is running in “Safe Mode” by running:
<?php
echo phpinfo();
?>Search for the word “safe_mode”. It should be set to “Off”.
2) Finding the server path to the directory in which the template files should be saved.
After numerous failed attempts at working out (Thumb Sucking) the path I decide to take a look at the log files (access_log, error_log) being generated. Logs written to the error_log file provided me with the correct path.
From the following log:
client 61.16.11.60] File does not exist: /usr/local/psa/home/vhosts/mydomain.com/httpdocs/favicon.ico
I was able to get the correct path:
/usr/local/psa/home/vhosts/mydomain.com/httpdocs/my_template_folder/
Hope this comes in handy for anyone in a similar situation.
HP