Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have several websites-with a comm 1

Status
Not open for further replies.

JerryBarrett

Technical User
Jan 18, 2004
76
GB
I have several websites-with a common theme into which I want to insert some URL-unique info - I have a working perl script, but some of the webs are on a Linux server and lots are on a Windows IIS(5) server.

To call the perl script on the Linux system I have to use

<!--#exec cgi=&quot;cgi-bin/testtags.pl&quot;-->

or

<!--#exec cgi=&quot;./cgi-bin/testtags.pl&quot;-->

and

<!--#exec cgi=&quot;/cgi-bin/testtags.pl&quot;--> Will not work.


On the windows IIS I &quot;have&quot; to call the perl script with

<!--#exec cgi=&quot;/cgi-bin/testtags.pl&quot;-->

a relative path within the website will not work.


Any ideas how I get this down to one single path definition?

Ideas appreciated

Regards
Jerry

 
I'd ask this question on a Javascript forum... you can determine your operating system using this method and then execute either Linux [red]OR[/red] IIS call... then the exec cgi will be fine regardless

should work - shouldn't it???


Kind Regards
Duncan
 
This may be silly - but isn't Javascrpt for Client side processing so wont be exec'd until delivered to the desktop.

SSI is server side - is there a perl commad to find the OS? can I test that in the html? or am I back in the same boat

Jerry
 
Well, you just said it yourself. Perl/CGI is server side, so in effect it isn't running on the clients computer, and therefore cannot get the clients details (i.e.OS), unless the client sends it his details. Therefore you will have to incorporate some sort of javascript code to determine the os, and then call the correct script from that.

duncdude was right, post this problem in the javascript forum, there are more than enough people willing to help out.

Sean.
 
Dunc/Jerry: How do you propose to use Javascript to tell what OS is used on the server? How are you going to use it to control an SSI script that's already been run by the time it reaches the browser? Read up on SSI in faq253-3309 and faq253-2000 .

Forget Javascript - it's a red herring. Instead, try using include instead of the exec directive:
[tt]
<!--#include virtual=&quot;/cgi-bin/testtags.pl&quot; -->
[/tt]
Remember also that testtags.pl will need to send the proper mime header in your program:
[tt]
print &quot;content-type: text/html\n\n&quot;;
[/tt]

-- Chris Hunt
 
Oh dear I dont think I made my self very clear.

It isn't the client computer OS that needs to be recognised its the Server on which the script will run - the client will have no idea or care.

I'm at a loss as to how javascript will help?

I've sorta come up with a solution - but it will only work if I can redirect the CGI/SSI error away from the webpage - is that possible?

I simply add both 'exec cgi command-paths' to the html, it runs both - one will work the other wont - but I get an error message from the failed on the webpage.

Regards
Jerry

 
both sean4e and myself are confused! (thanks sean for your vote of confidence by the way!)

if you need to find the OS from Perl...

[red]print $^O;[/red]

this should help - i hope!


Kind Regards
Duncan
 
Hi mate,

Chris has the best solution for this above, but if that doesn't work, try this.

<!--#if expr=&quot;${SERVER_SOFTWARE} = /Unix/&quot; -->
Running Unix
<!--#else -->
Running Windows
<!--#endif -->

This may not work, it assumes that the Unix server is sending the full software response to SERVER_SOFTWARE, but some servers do not. Windows will work no matter what as the first expression will never come true on a Windows machine.

If it doesn't work, try putting <!--#echo var=&quot;SERVER_SOFTWARE&quot; --> into a page and call it, you can then see what the server is returning and can alter the first expression based on that.

Hope this helps

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Outstanding....

Wullie - absolutely brill just what I wanted and it works a treat...

I had already tried the virtual include - and had the same problems..

Check the server and the Linux one came back with 'Apache'

Wicked - Thanks so much.

Cheers
Jerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top