PHP and permissions

Miscellaneous Forums/General Discussion/PHP and permissions

I am using PHP 4 to write and edit files. So far this works except for one problem: Permissions.
My PHP script is not allowed to edit any files unless they have permissions set to allow anyone to write to the file.
(Otherwise, I get this error:
Warning: fopen(/home/sites/crumbsoftware/www/public_html/DHS/sitedata): failed to open stream: Permission denied in /home/sites/crumbsoftware/www/public_html/DHS/admin/file.php on line 17
)

I have been looking on PHP.net for a while and can't find anything that really helps me...
So, how can I change PHP's access rights so that it has group/owner access to all files on my server?
(Or simply does not pay attention to the bloody permissions system).

Thanks in advance!

I think it doesn't depend only on PHP, but by the server too. If I remember correctly is something related to the chmod() function.

Yes, I've found lots of stuff pointing to chmod, and I'm assuming that my FTP program does everything to do with that function for me when I right click a file and choose "Properties/CHMOD". However, all that I can change here is permissions... and I really don't want to change the permissions on every file on my server to allow Public to Write.

chown()

Find out who PHP is running as on your server by creating a new file with PHP. If you set the files to be owned by the user that PHP runs as, you should be able to get away with 0700.