Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:23:47+00:00 2026-06-10T21:23:47+00:00

So, I have this error: Warning: fopen(/path/to/test-in.txt) [function.fopen]: failed to open stream: Permission denied

  • 0

So, I have this error:

Warning: fopen(/path/to/test-in.txt) [function.fopen]: failed to open stream: Permission denied

Performing ls -l in the directory where test-in.txt is produces the following output:

-rw-r--r-- 1 $USER $USER 1921 Sep  6 20:09 test-in.txt
-rw-r--r-- 1 $USER $USER    0 Sep  6 20:08 test-out.txt

In order to get past this, I decided to perform the following:

chgrp -R www-data /path/to/php/webroot

And then did:

chmod g+rw /path/to/php/webroot

Yet, I still get this error when I run my php5 script to open the file. Why is this happening? I’ve tried this using LAMP as well as cherokee through CGI, so it can’t be this.

Is there a solution of some sort?

Edit

I’ll also add that I’m just developing via localhost right now.

Update – PHP fopen() line

$fullpath = $this->fileRoot . $this->fileInData['fileName'];

$file_ptr = fopen( $fullpath, 'r+' );

I should also mention I’d like to stick with Cherokee if possible. What’s this deal about setting file permissions for Apache/Cherokee?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:23:48+00:00Added an answer on June 10, 2026 at 9:23 pm

    Check if the user that PHP runs under have “X” permission on every directory of the file path.
    It will need it to access the file

    If your file is: /path/to/test-in.txt
    You should have X permission on:

    • /path
    • /path/to

    and read permission on /path/to/test-in.txt

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use to deploy tomcat webapps through eclipse but I have this error: WARNING:
I have this code: function makeUser() { $info['cn'] = Test User; $info['sn'] = User;
I have following code: $fh=fopen($api,r); $theData = fgets($fh); echo $theData; This throws the error
i have this function, and i get this error Deprecated: Function eregi() is deprecated
I have this code: <?php $LF = 'links.txt'; $Rfp = fopen($LF, 'r'); while(!feof($Rfp)) {
I have this code: $file = fopen($_SERVER['DOCUMENT_ROOT'].'crawl.txt', 'w+'); $time1 = microtime(true); ...... $time2 =
I have this error when trying to generate the meta model with JOOQ: org.jooq.exception.DataAccessException:
I Have this error message : Possible unitended reference comparison; to get a value
I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
I have this error that is keeping me from moving forward. I basically have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.