GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ 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 07-Dec-2007, 21:54
BKaney BKaney is offline
New Member
 
Join Date: Dec 2007
Location: Oklahoma
Posts: 5
BKaney is on a distinguished road

System call works or not depending on 'who' runs the program


I'm not sure if this is more of a linux, shell, apache server or c++ question.

For the last few years I've written some c++ programs that act as the cgi of a webpage that generates weather images.

The c++ executables are nothing long or fancy, they write out some html and respond to form input. The programs also contain just a couple of system calls including a call to some other c++ programs to create an image file from raw data (that will then be used in the html that follows). Something like:

system("path/my_image_drawing_executable arg1 arg2 arg3");

This has worked fine so far, but I've run into a problem with a recent implementation on a different machine. If I log onto the machine and run the cgi program (a c++ exec.) manually from the command line the whole thing runs fine. But if someone runs the same program 'coming in' from the outside through the web server it doesn't work. The cgi program does execute and does everything it should except it ignores the system calls.

Took me awhile to figure out what was happening, but I finally just commented out all of the system calls and put in the block:

CPP / C++ / C Code:

  if(system(NULL)==0)  cout<<"<br><br>System Not There<br><br>";
  else                        cout<<"<br><br>System Ready<br><br>";


and indeed when I run it manually from the command line I get 'System Ready' and then when I run the exact same program with the exact same args by typing it in a URL it gives me a 'System Not There' message.

I'm guessing some sort of shell, permission, apache issue? All of my cgi files,dir,etc are permission 775 so they should be readable and executeable by all. Unless apache is overriding something.

Thanks a bunch for any advice, theories, etc. you might have.

Brian Kaney
 
 

Recent GIDBlogLast Week of IA Training 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
Will pay through Paypal if somebody helps me. paritoshcool Assembly Language 0 27-Nov-2007 22:27
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 10:13
How to read particular memory location ? realnapster C Programming Language 10 10-May-2006 09:11
[TUTORIAL] Calling an external program in C (Linux) dsmith C Programming Language 4 22-Apr-2005 13:30

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

All times are GMT -6. The time now is 00:23.


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