Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 2nd, 2001, 06:39 PM
Emanresu Emanresu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Emanresu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy please help with a crazy perl script!

I wrote a script that is supposed to run a bunch of programs outside the script but it's not working quite right. When I run it in offline mode and enter the name value pairs manually, it works fine, but when I call it using a web browser, it doesn't execute the programs, or at least doesn't execute them correctly. One fragment of code looks like this:

open(IDL, "|/usr/local/bin/idl >/dev/null 2>&1") || die "Unable to open\n";
print IDL "\@/home/httpd/cgi-bin/gavrt-swics-database/BATCH.pro", "\n";
close(IDL);

It is supposed to open idl and then run an idl program. The idl program creates an eps picture. It actually creates this picture when I run it from the command prompt, but doesn't create it from a browser actually using the script. I also tried doing it this way:

system "/usr/local/bin/idl", "/home/httpd/cgi-bin/gavrt-swics-database/BATCH.pro";

and got the same results. I also tried this:

system "/usr/X11R6/bin/convert", "/home/httpd/cgi-bin/gavrt-swics-database/mmq_plot.eps", "/home/httpd/cgi-bin/gavrt-swics-database/mmq_plot.gif";

and this:

system "/usr/X11R6/bin/convert /home/httpd/cgi-bin/gavrt-swics-database/mmq_plot.eps /home/httpd/cgi-bin/gavrt-swics-database/mmq_plot.gif";

to convert the eps image into a gif, but I had the same problem...it won't work from a browser. Any ideas what's going wrong? Thanks a lot for the help!

Reply With Quote
  #2  
Old July 2nd, 2001, 08:04 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
That's because the script is probably running under 2 different users (1 in offline mode, and another one when accessed from the web). Unless your host has suexec install, then the web-called version is probably running as somebody like 'apache' or 'nobody'. You need to make sure you have correct file and directory permissions.
__________________
Jon Coulter
ledjon@ledjon.com

Reply With Quote
  #3  
Old July 2nd, 2001, 11:05 PM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
As JonLed said, you need to make sure your script has proper permissions, that being mode 755.

Also, this may seem trite, but you didn't mention whether or not you were using CGI.pm or equivalent coding. This could part of why your script is not working in your browser.
__________________
- dsb -
Perl Guy

Reply With Quote
  #4  
Old July 3rd, 2001, 09:02 AM
Emanresu Emanresu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Emanresu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hmmm...

First of all, thanks for the quick reply. I thought it was the user thing at first also, but I made sure my script had permissions of 755. I'm using CGI.pm and the script as a whole (it's a series of forms) runs fine without the above code in it. The forms all appear and work etc. I just can't run any external commands. Are there any permissions I'm forgetting about? Any other ideas? Thanks.

Reply With Quote
  #5  
Old July 3rd, 2001, 09:16 AM
Emanresu Emanresu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Emanresu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
aha

It look like you were right. One of the folders had the wrong permissions so I changed it and everything works great now. Thanks a lot.

Reply With Quote
  #6  
Old July 3rd, 2001, 09:46 AM
Emanresu Emanresu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Emanresu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hmm, it seems I was a little premature in my judgement. The convert command now works from the web, but the idl one still doesn't no matter which way I do it. I can't think of any folders or files that would have to be changed either. Any suggestions? Thanks a lot.

Reply With Quote
  #7  
Old July 3rd, 2001, 07:32 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Log in as user Web runs under

Try logging in as the user that the web service runs under.

ie Nobody or apache

run on the command line and see if you have any errors.

Since one command works look at directory and file permissions
for the working one and compare them with the not working one.
Are there any symbolic links ? and their permissions ?

Look at the parent directory just above where the script runs :
Does this folder have permissions to allow a "nobody" user to run programs.

Look at the documentation for the software you are trying to run
are there any help files about running this off the web ??

Can you email or contact their tech support ??

Do you have a developer box that you can try opening up permissions on as a test. It is best to be carefull about experimenting on a production machine with permissions while it is on the internet.

Or ?? or info required.

Hope you keep looking and find your answer.
__________________
Thanks

Foot in Mouth ver 1.2.5 Onion

Reply With Quote
  #8  
Old July 5th, 2001, 10:06 AM
Emanresu Emanresu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Emanresu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the help

I figured out the problem. Thanks everyone.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > please help with a crazy perl script!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT