GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 28-Feb-2004, 01:55
mikenowo mikenowo is offline
New Member
 
Join Date: Feb 2004
Posts: 13
mikenowo is on a distinguished road

c++/cgi program can't open file in user dir


I'm trying to open/create a file in a user dir with some c++/cgi code but am
getting an error saying it can't. I pass a filename to the following
functions but the file does not get created/open. When I get to the " if
(!html_file)" 'if' statement (see code snippet below) it doesn't find the
file

I have a feeling it has to do with permissions again, but everything seems
set correctly.
Any ideas? (If any moer info is needed please let me know).


DETAILS:

Code snippet:
***
HTMLstream::HTMLstream (const string & filename)
{
open (filename);
}

void HTMLstream:pen (const string & filename)
{
ifstream html_file (filename.c_str());
if (!html_file)
{
throw invalid_argument ("Could not open data file: " + filename);
}
string line = "";
while (getline (html_file, line))
{
html_code += line;
html_code += '\n';
}
}
.
.
.
***


The cgi user directory is "/home/group3/public_html/cgi-bin"
and the programs and directory all have grp/owner 'group3' and 755
permissions.


'httpd.conf' file specifics:
***
UserDir public_html
.
.
<Directory "/home/*/public_html/cgi-bin">
AllowOverride All
Options Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
<Directory "/home/group3/public_html/cgi-bin">
AllowOverride All
Options +ExecCGI
</Directory>

<Directory "/home/*/public_html">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
.
.
AddHandler cgi-script .cgi
***
  #2  
Old 03-Mar-2004, 04:46
Allowee's Avatar
Allowee Allowee is offline
Regular Member
 
Join Date: May 2003
Location: The Netherlands
Posts: 339
Allowee has a spectacular aura about
if you set the permission (chmod) at 777, does it work?
if that works there is a persmision problem with the group.

if it does not work with the root user your script has a problem..
I'm not an C++ expert, sorry
__________________
Pastebin
PHP Documentation Site
Allowee's Blog http://allowee.net
  #3  
Old 04-Mar-2004, 19:33
mikenowo mikenowo is offline
New Member
 
Join Date: Feb 2004
Posts: 13
mikenowo is on a distinguished road
Quote:
Originally Posted by Allowee
if you set the permission (chmod) at 777, does it work?
if that works there is a persmision problem with the group.

if it does not work with the root user your script has a problem..
I'm not an C++ expert, sorry

Actually, turns out I was trying to open an existing file which was missing NOT trying to create one. I copied it to the correct dir, now all works well.
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 4) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to open file in c++ mohammed C++ Forum 4 02-May-2006 17:10
Mozilla Thunderbird dsmith Computer Software Forum - Linux 9 01-Mar-2005 11:56
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
[Tutorial] Standard I/O aaroncohn C Programming Language 20 27-Feb-2004 21:07

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:41.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.