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 8080547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:26:47+00:00 2026-06-05T16:26:47+00:00

After ages of programming in php this question seems really weird still to me.

  • 0

After ages of programming in php this question seems really weird still to me.

I want to make a file writable dinamically to not have problem with permissions in production / development …. but it still gives me trouble.

Can someone gives me explanation on what am I wrong?

// permissions    -- the folder writable by www-data
//drwxrwxrwx 2 www-data www-data  4096 mag 24 12:19 Details

// then the file not writable by the owner
-r----x--t 1 www-data www-data 0 giu  8 12:48 /home/giuseppe/homeProj//Ariprova/trunk/PhpCsv/phpcsv/ConfigClasses/Helpers/Virtuemart2/Details/324-PartsToAdd.json

// then the code

if (!file_exists($fileRequest)) {   // it's found
                throw new Exception ('File non trovato. Nome File completo: '.$fileRequest. ' con cartella '.  getcwd()); 
                }  

if (!is_writable($fileRequest)) {
                $results = @chmod($fileRequest, '0777');  //this gives true 

            }

            $fileReq = fopen($fileRequest, 'w');
            fwrite($fileReq, 'a string' );   // this writes nothing on file

            fclose($fileReq);
  • 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-05T16:26:49+00:00Added an answer on June 5, 2026 at 4:26 pm

    Change chmod($fileRequest, '0777') to chmod($fileRequest, 0777). The string '0777' will be converted to a numeric value, which will be 777 decimal, which is not what you expect; what you really want is 0777 octal.

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

Sidebar

Related Questions

I'm just becoming dive into php after ages working in vb.net. I wanna write
I've had this problem for ages, and it's SO ANNOYING. Suppose I want to
After parsing a json file which contains names and ages of people, {People: [
After googeling for ages, and reading some stuff about async task in books. I
After deploying WCF server (svc) on my Server, I have got this message when
After some time researching and trying different things I still cannot get my @ExceptionHandler
After a long search I'm still confused about it although I found some related
Let's say file.txt.gz has 2GB, and I want to see last 100 lines or
After creating roles and granting privileges to them, I want to grant the privileges
After executing this query on master db ,it is giving me all running process

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.