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

  • Home
  • SEARCH
  • 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 8220789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:39:43+00:00 2026-06-07T13:39:43+00:00

I am trying to create a file and write a message in a folder

  • 0

I am trying to create a file and write a message in a folder called debug:

 function debug($report){
   $file="/debug/debug.txt";
   file_put_contents($file,$report,FILE_APPEND | LOCK_EX);
 }

The debug folder is in my root directory. But file fails to be created.. Why?

  • 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-07T13:39:46+00:00Added an answer on June 7, 2026 at 1:39 pm

    This code will open all the permissions for the folder.

    chmod('PATH_TO_FOLDER',0777);
    

    Depending on what exactly you want to do with that folder, you might consider giving it slightly more limited permissions that allow only specific users to read/write to it.

    Here are some other examples taken from the PHP manual – http://php.net/manual/en/function.chmod.php

    <?php
    // Read and write for owner, nothing for everybody else
    chmod("/somedir/somefile", 0600);
    
    // Read and write for owner, read for everybody else
    chmod("/somedir/somefile", 0644);
    
    // Everything for owner, read and execute for others
    chmod("/somedir/somefile", 0755);
    
    // Everything for owner, read and execute for owner's group
    chmod("/somedir/somefile", 0750);
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a write only file in C on Linux (Ubuntu).
I'm trying to create a folder and create a file within it. Whenever i
I am trying to write a function to determine if a file exists. The
Here's an idea. I'm trying to create file from PHP script. File may be
Im trying to create new file on D: drive with c/c++ I found this
I am trying to create a file using File newFile = new File(myFile); However
I am just trying to create a file with QProcess by the following source
I have just started learning python version 3 and trying to create a file
I am trying to create a json file from a rake task using rabl.
I'm trying to create a .vcs file in C#. Basically in outlook if you

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.