I am trying to create XML sitemaps for my website from my PHP application. The idea is to either create a new file or overwrite an existing file. When I call fopen, I get the following error:
[function.fopen]: failed to open stream: Permission denied
I am trying to write webroot and its permissions: 755. This means that the owner has write permission, right? What do I need to do so that my script can write to this folder? 777 would be bad, right? Can I run my script as the owner?
Thank.
, , 777 . - , .
:
302 Redirect
sitemap.xml
!
, . Ubuntu linux w/php apache
<?php exec('whoami'); ?>
sudo apachectl restart
, :
ACL webroot, -.
setfacl -m u:apache:rwx /var/www/html
apache - /var/www/html -.
apache
/var/www/html
, apache nobody
,
useradd -G nobody youruser chown -R youruser:nobody .
0775
chmod -R 0775 .
useradd -G nobody yourgroup
777 , PHP , PHP, Apache .. , - , / .
(.. 775)? , . PHP ( www-data) , , 775 ( 774).
! apache
<?php exec'whoami'; ?>
useradd -G username username2 chown -R username:username2 . chmod -R 0775 .
! !