469,926 Members | 1,561 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Permission denied when creating a file in PHP

other interesting thing i observe during my work which i describe below:

i am using dotproject2.0.4 on fc3.
it is working fine.
but i want to generate pdf file report during this time i face permission denied problem.

Warning: fopen(/var/www/html/dotproject/files/temp/temp1.pdf): failed to open stream: Permission denied in /var/www/html/dotproject/modules/projects/reports/tasklogs.php on line 307
Could not open file to save PDF.

when i run below test php file using command line it will create file at particular location.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $file = fopen("/var/www/html/dotproject/files/temp/test.txt","w");
  3. print $file;
  4. $file1 = fopen("/var/www/html/dotproject/files/temp/test1.pdf","wb");
  5. print "hai $file1";
  6. ?>
[Please use CODE tags when posting source code. Thanks! --pbmods]


but when i run this php file in web browser it would not create file.

as i conclude it is problem with related to permission for user.

bec when i run from command line it runs with the permissions of the user who started the script means root if i login as root user.

but from web browser it runs as web browser user.

in my httpd.conf file user and group is as follow

User Apache
Group Apache


how to set permission so web browser user also can access file and create file.

i have change all directory permission to 777 and also test file permission.

/var/www/html/test/

but still it will not working.

it resolves my many issue related to permission.

is there any other issue?


thanks in advance
Jun 29 '07 #1
1 3267
pbmods
5,821 Expert 4TB
Changed thread title to better describe the problem (did you know that threads whose titles contain phrases such as 'problem' actually get FEWER responses?).
Jun 29 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Andy | last post: by
4 posts views Thread by nitinpatel1117 | last post: by
reply views Thread by private.anders | last post: by
reply views Thread by private.anders | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.