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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:20:31+00:00 2026-05-15T07:20:31+00:00

fopen function is not working in php. I wrote the following code in my

  • 0

fopen function is not working in php.

I wrote the following code in my php file.

            $fh =  fopen("/home/sugumar/Public_html/sugumar/public_html/123","a+");

            fwrite($fh,"hello");

I ran this code from command line: php file_name.php its working fine.
But If I run this code from browser it shows the following error.

Warning: fopen(Logs/add_employee.logs)
[function.fopen]: failed to open
stream: Permission denied in
/home/sugumar/Public_html/sugumar/public_html/HRMS/HRMS_add_emp_DB.php
on line 111

Warning: fwrite(): supplied argument is
not a valid stream resource in
/home/sugumar/Public_html/sugumar/public_html/HRMS/HRMS_add_emp_DB.php
on line 113

how to solve this problem?

Thanks in advance.

  • 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-05-15T07:20:31+00:00Added an answer on May 15, 2026 at 7:20 am

    I don’t think it’s a good idea at all to chmod your public HTML folder to 777. Besides the error message states that it is not the public_html folder that has permission problems, but the Logs folder… specifically this particular file in the Logs folder does not have “write” access: add_employee.logs

    To change permissions, just find the location of the Logs folder, then if you have access to SSH, cd to the Logs folder on the server and enter:

    chmod 666 add_employee.logs
    

    This will change the permissions of the add_employee.logs to read + write, so your PHP will be able to write to the file.

    If you don’t have SSH, try using your FTP client to connect to the server. Then navigate to the Logs folder on your server (depends on whether your hosting provider allows FTP access to this folder). Depending on the FTP client you have, you should be able to right-click on a file/folder and change permissions for the selected file/folder.

    If you can’t access the Logs folder with FTP, your hosting provider should offer a CPanel website for you to login to. From the CPanel, you should have access to some kind of file manager, where you can access the Logs folder and can change the file’s permissions from there. Can’t give you instructions here as I have no idea which CPanel software your hosting provider uses and they’re all very different.

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

Sidebar

Related Questions

I tried to open a file with fopen() function in PHP and it output
I am learning php, trying to use the fopen() function. The php file I
how to map the path to the file easily? public_html/api/function.php <?php function writetologfile($content) {
EDIT: To answer some questions, this is the revised and still not working code
I'm new to PHP. I'm using the following code to generate an excel sheet
I have this function which writes content to a text file: function write($text){ fwrite($this->fp,
I'm expecting an issue with the PHP function fwrite() $filename = 'rss.xml'; if (file_exists($filename))
Is it possible to call a PHP function found in a file on another
As I have not waited for the children process in the following code, but
It has always struck me as strange that the C function fopen() takes a

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.