|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
|||
|
|||
|
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.
|
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
Thanks for the help
I figured out the problem. Thanks everyone.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > please help with a crazy perl script! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|