Permission denied to create new pdf file in project report of dotproject2.0.4

Discussion in 'PHP' started by hardik, Jun 29, 2007.

  1. #1
    i am using dotproject 2.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.

    <?php
    $file = fopen("/var/www/html/dotproject/files/temp/test.txt","w");
    print $file;
    $file1 = fopen("/var/www/html/dotproject/files/temp/test1.pdf","wb");
    print "hai $file1";
    ?>

    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.

    so can any one help to resolve permission problem

    it resolves my many issue related to permission.

    thanks
     
    hardik, Jun 29, 2007 IP
  2. UnrealEd

    UnrealEd Peon

    Messages:
    148
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use php's chmod function to set the permission to 0777 (read/write/execute for all):
    chmod ( '/var/www/html/dotproject/files/temp/test.txt', 0777 );
    PHP:
    if the file is created via the script, you have to chmod the folder as well:
    chmod ( '/var/www/html/dotproject/files/temp', 0777 );
    PHP:
     
    UnrealEd, Jun 29, 2007 IP
  3. hardik

    hardik Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hai

    is there any setting in php.ini file or .htaccess file..


    which will restrict me to create this file in php.


    thanks
     
    hardik, Jun 29, 2007 IP