Use perl in apache without #!/path/to/perl

  • Thread starter Kostas Hatzikokolakis
  • Start date
K

Kostas Hatzikokolakis

Hi,
I want to set up apache to use the perl interpreter automatically for
all .pl files, without the need to have a #!/path/to/perl directive in
each file. This is beacause I want to use a winows machine to test
some scripts created in linux, thus havind #!/usr/bin/perl instead of
#!c:\Perl\bin\perl.exe. I tried the following in httpd.conf

AddType application/x-httpd-perl .pl
ScriptAlias /_pl/ "c:/perl/bin/"
Action application/x-httpd-perl "/_pl/perl.exe"

that should normaly do the trick (i configured php similarly) but I
get the following error:

[Sat Oct 18 15:22:16 2003] [error] [client 127.0.0.1] Premature end of
script headers: perl.exe

Does anyone have a solution to this problem?
Thanks in advance.

Kostas Chatzikokolakis
 
J

James Willmore

On 18 Oct 2003 06:32:11 -0700
Hi,
I want to set up apache to use the perl interpreter automatically
for all .pl files, without the need to have a #!/path/to/perl
directive in each file. This is beacause I want to use a winows
machine to test some scripts created in linux, thus havind
#!/usr/bin/perl instead of#!c:\Perl\bin\perl.exe. I tried the
following in httpd.conf

AddType application/x-httpd-perl .pl
ScriptAlias /_pl/ "c:/perl/bin/"
Action application/x-httpd-perl "/_pl/perl.exe"

that should normaly do the trick (i configured php similarly) but I
get the following error:

[Sat Oct 18 15:22:16 2003] [error] [client 127.0.0.1] Premature end
of script headers: perl.exe

Does anyone have a solution to this problem?
Thanks in advance.

Kostas Chatzikokolakis

Yes - read the Apache documentation (http://httpd.apache.org/). It is
outlined there what to do to set up running scripts.

Just a hint - your ScriptAlias is wrong. It needs to point to where
the scripts are located, _not_ where the Perl interpreter is. If you
have put your Perl scripts in the same directory as the Perl
interpreter, you have now opened a very large security hole on your
server.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
If all else fails, immortality can always be assured by
<spectacular error. -- John Kenneth Galbraith
 
R

Ron Savage

On Sat, 18 Oct 2003 23:32:11 +1000, (e-mail address removed) wrote:

Hi Kostas
 I want to set up apache to use the perl interpreter automatically
 for all .pl files, without the need to have a #!/path/to/perl
 directive in each file. This is beacause I want to use a winows
 machine to test some scripts created in linux, thus havind #!
 /usr/bin/perl instead of #!c:\Perl\bin\perl.exe. I tried the
 following in httpd.conf

You're doing it the hard way.

Under Windows, create c:\usr, and inside it c:\usr\bin.

Then copy perl.exe from c:\perl\bin to c:\usr\bin.

Now all your scripts - on both platforms - can start with

#!/usr/bin/perl

That's what I've been doing for a 3 or 4 years. And many thanx (again) tothe guy who pointed it out to me!

You don't need to patch httpd.conf.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top