Click to See Complete Forum and Search --> : Why cant my C++ cgi-bin program create files
Joncamp
05-31-2006, 09:57 PM
My c++ cgi-bin is working now, getting post fields from environment variable, etc. And great thanks to all for your help.
But, now the problem is that the c++ cgi-bin program cant create files, which it uses for a database for the web site on Apache? In fact it can't even read from the database files?
Kind regards,
Jon
dkeav
05-31-2006, 10:46 PM
get a better program and/or programmer ?
Choozo
06-01-2006, 02:46 AM
A file permission issue?
Joncamp
06-06-2006, 11:08 AM
With Apache, when it starts a cgi-bin program it does not load a shell, it runs the cgi-bin program directly. Without a shell environment the program can't access file system paths. When you use perl for cgi-bin it loads a shell, however c++ compiled programs do not load a shell.
The solution, if your cgi-bin needs file access, use perl with the system calls to execute your c++ cgi-bin program. That would be slow to start all those processes, so PHP is really a better choice.
bwkaz
06-06-2006, 07:18 PM
Or, just do the CGI program in Perl or PHP, like a few people suggested when you said you were trying to do it in C++... :p