Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello All:
 
This is probably more an apache issue than a perl issue. Still, I have been asking for help from apache folks and gotten none. So in the words of Mathezar of Galaxy Quest, "You are our last hope!"
 
There is a similar thread under "System and CGI - File Created but not the Content". I thought this was different enough to post separately becasue SELinux is off in my case and perl is the file writter.
 
#!/usr/bin/perl use strict; print "Content-Type: text/html\r\n\r\n"; print "<HTML>\n"; print "<HEAD>\n"; print "</HEAD>\n"; print "<BODY>\n"; my $filename ="/var/www/html/DATA/kk.txt"; open(KK,">$filename"); close(KK); # this line and the nex +t 2 were not part of system("chmod 666 $filename"); # of the original code. + They were added to open(KK,">>$filename"); # see if changing the p +ermissions would help print "we are trying to write\n"; print KK "we are trying to write\n"; close(KK); print "</BODY>\n"; print "</HTML>\n";
When executed the browser shows "we are trying to write", the /var/www/html/DATA/kk.txt file exists, it is 666, owned by apache and has zero content.
 
I am running FC4, Apache 2.0.54, perl 5.8.6, the server is not attached to the internet.
 
I have done what should never be done: 777 permissions on /var, /var/www, /var/www/html.
Below html I have a directory called DATA, also 777
user apache owns everything below var
setenforce 0 to remove SElinux
(basically, a desperate and ridiculous attempt to allow files to be written)
 
The odd thing is that the original program (from which this was extracted) up to 10am 9/17/2006. After that, the machine, untouched, exhibited the new behaviour.
 
All written files prior to 10 am 9/17 are apache 644 and have content. All written files after to 10am 9/17 are apache 644 and are empty.
 
1) I am probably not doing this the right way ... where should I be writting the files and how should I set upms and httpd.conf. I have been trolling google with "apache permissions" apachec cgi write files" and the like. If you have links to howtos, please send them!
 
2) In the above case, can I determine the reason and fix it? It would be nice to be able to dial back the permissions to something reasonable
 
Thanks in advance.

In reply to System and CGI - File Created but not the Content (Similar Situation) by holandes777

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-19 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found