PDA

View Full Version : How to run a Perl prog from an index.htm file


hkgray
10-30-2002, 02:19 PM
Dear all,

I have a cgi program written in Perl. I would try to run it in an index.htm file (run automatically when load the index.htm file). How could I code the html file to run the cgi program in another directory?

Thanks
Raymond

toolkit
10-30-2002, 02:55 PM
You can use SSI to run a perl script via a html page. If you have SSI enabled on your server (you may need to change the file extension of your html page to .shtml), just include code like this:
<!--#include virtual="/path/to/your/script.pl"-->
...where you want the script's output (if any) to appear.

hkgray
10-30-2002, 03:17 PM
Dear Sir,

Thank yo for your reply.

I tried to use the script but there were some problems in running.

Should I insert the script in the body or header?

If the hosting company do not provide SSL, is there any other method?

Is the path "/home/mydomain.com/www/the path/script.pl" when I create the path? (my address is www.mydomain.com/thepath/script.pl)

Thanks
Raymond

toolkit
10-30-2002, 03:27 PM
Hi hkgray

No need to call me sir ;)

Should I insert the script in the body or header?
ideally inbetween the <BODY></BODY> tags somewhere

If the hosting company do not provide SSL, is there any other method?
It's 'SSI' (meaning Server Side Includes) totally different from SSL, which is to do with secure connections. Most good hosting companies should be able to provide you with SSI. If not, there are plenty of good and cheap hosting companies that willl supply what you want.

Is the path "/home/mydomain.com/www/thepath/script.pl" when I create the path? (my address is www.mydomain.com/thepath/script.pl)
It'll be "/thepath/script.pl"

Hope this helps :thumbsup:

hkgray
10-30-2002, 04:04 PM
Dear Mr. Toolkit,

My hosting company support SSI, but I inserted the script without any effect. An empty page was downloaded after browse the index.htm.

Is there any method?

Thanks
Raymond

toolkit
10-30-2002, 04:49 PM
You may need to rename the file to index.shtml (the .shtml extension is to tell the server to parse the file for SSI)

Will your hosting company not give you some guidelines on using SSI on their server?

hkgray
10-30-2002, 05:59 PM
Dear Mr. Toolkit,

I change it to index.shmtl. It was success. I can reach the cgi in index.shtm. But it caused another problem. I have another cgi file in another directory. It was not function properly. Is the SSI affected the path in other directory?

Thanks
Raymond

toolkit
10-31-2002, 10:25 AM
Yes, to run another script you will need an addidional
<!--#include virtual="/path/to/your/script.pl"-->
line with the path to the other script.

Remember the path to the script is taken from web root.