I have a server on rackspace clouds... Fedora 13, and I installed apache, mysql.
Now, I have a piece of code (PHP) that my web app uses a lot. It works on my local machine running XAMPP, but when I upload this code on my rackspace server, it doesn't work:
$myFile = "textfile.txt";
$fh = fopen($myFile, 'w') or die("cant open");
$stringData = "CONTENT";
fwrite($fh, $stringData);
fclose($fh);
Really simple PHP code that should just work. However, it wont create the file, and if I upload textfile.txt file myself, and give the permissions myself to 0666 then it edits the file. However, this isn't ideal, since it still wont create new files (or directories) and chmoding each one by hand isn't feasible.
The owner of the file is root and the group is root
How do I make this work?
UPDATE - Fixed
I changed the owner to apache:apache doing: chown -R apache:apache /var/www/html
That seemed to work :)
Is there any security issues with that, or is that fine to have the user apache and the group apache?
Thanks!