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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:22:46+00:00 2026-06-13T21:22:46+00:00

I have installed apache server on a linux fedora machine and I put the

  • 0

I have installed apache server on a linux fedora machine
and I put the following test.php and test.html on var/www/html
but when I open the 127.0.0.1/test.html on firefox
the test.php doesn’t create the text.txt file, let alone write the string to the file
and the there is also no output for “echo $var”

the error is

Warning: file_put_contents(test.txt): failed to open stream: Permission denied in /var/www/html/getdata.php on line 7

the permission for the directory is:

drwxr-xr-x. 2 root root 4096 Nov  6 14:14 html

test.php:

<?php
$v="x";
$fname='test.txt';
$rv=file_put_contents($fname,$v);
echo $rv;
echo $v;
?>

the test.html is so complex coz I planned to write something complex to a file on the server, but since there is some problem, I simplified the test.php

test.html:

<!DOCTYPE html>
<html>
<body>

<form id="yourFormID" method="POST" action="/getdata.php" ></form>

<script>
  function sendArray( theArray )
  {
    var frm = document.getElementById('yourFormID');
    fld = document.createElement("INPUT");
    fld.name ="data"; 
    fld.type = "hidden";
    fld.value = JSON.stringify(theArray);
    frm.appendChild(fld);  
    frm.submit();
   }

   var yourArray = [0.000023323,0.00001292,0.00003323];

    sendArray( yourArray );

    </script>
    </body>
    </html>
  • 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-13T21:22:47+00:00Added an answer on June 13, 2026 at 9:22 pm

    The html directory is currently owned by root, but under Fedora the web server runs as the “apache” user. (see “Apache File Security” section of https://fedoraproject.org/wiki/Administration_Guide_Draft/Apache?rd=Docs/Drafts/AGBeta/Apache )

    So, as root, do:

     chown -R apache:apache /var/www/html/
     chmod -R 770 /var/www/html
    

    The first makes the web server own the directory. The second makes sure that only users in the “apache” group can read/write files. It also says that no other users on the machine can even read them.

    If you ever need another user to be able to write files into your web tree, add them to the “apache” group.

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

Sidebar

Related Questions

I have installed PHP, Apache in my Linux server. http://localhost/index.htm displaying correctly. To test
I have installed native apache and mysql,php in my linux server. I tried a
I have a linux server running ubuntu 10.10 maverick with apache and php installed,
I have a Linux server Debian 6, with Apache 2.2 and PHP 5.4 installed.
I have set up a Linux Server and installed Apache and SVN and dav_svn
I have installed Apache web server on Redhat Linux and able to access the
I have a gentoo linux amd64 server that runs apache 2.2.22 with PHP 5.4.6.
I have a Apache installed on my Linux machine and I am trying to
I am just beginning with Joomla on a linux fedora server (running apache,mysql,php), running
I'm trying to add Apache server to Eclipse(Juno). I have installed Apache server 7.0,

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.