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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embed Perl in HTML Issue - Need quick help

Status
Not open for further replies.

westcoaststyle

Programmer
Oct 15, 2001
81
US
Hello all, I've been banging my head against my monitors all day today trying to figure out what is going on with some of my Apache hosted sites.

The configuration was done prior to my taking the administration over and I'm no Apache guru so... now you know what I'm dealing with.

I have one site and a file within the Apache config files for my website. On the same server and within the same Apache config directory I have a file for my website. These configuration files are fairly similar and I've basically copied all that I can between the two to get this working.

Here's the code in a "inlinePerl.html" file I created that I will reference below:

Code:
<html>
<body>
<p>THIS IS HTML</p>
<%perl
qq[<p>THIS IS PERL</p>];
%>
</body>
</html>

The situation is: if I put the aforementioned code in an .html file within the site folders (/export/home/ configured by the file then it spits out all HTML to the client, resulting in:

Code:
THIS IS HTML

THIS IS PERL

If I do the same thing in an .html file within the site folders (/export/home/ configured by the file it will not show me the THIS IS PERL in the browser. The source code at that point still shows the
Code:
<%perl
qq[<p>THIS IS PERL</p>];
%>

instead of the desired
Code:
<p>THIS IS PERL</p>

I've searched the entire server for "Mason" and "Embperl" (upper and lower case), but haven't found anything.

I can NOT figure this out. Any ideas?

I looked in the httpd.conf file for any indication of Perl packages that might enable this functionality for www1 and not I need help on this ASAP.

Thanks
 
Looks like PerlScript rather than raw perl, or mod_perl
google for configuring apache perlscript

HTH

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Here's the config file that works (edited for security purposes):

Code:
<VirtualHost XX.XX.XX.XX:80>
  ServerName [URL unfurl="true"]www1.xxxx.com[/URL]
  ServerAdmin webmaster@xxxx.com
  ServerAlias [URL unfurl="true"]www1.xxxx.com[/URL]
  ErrorLog /export/home/[URL unfurl="true"]www1/logs/error_log[/URL]
  CustomLog /export/home/[URL unfurl="true"]www1/logs/access_log[/URL] combined

  DocumentRoot /export/home/[URL unfurl="true"]www1/htdocs[/URL]
  PerlSetEnv DocumentRoot /export/home/[URL unfurl="true"]www1/htdocs/[/URL]
  <Directory "/export/home/[URL unfurl="true"]www1/htdocs">[/URL]
    Options Includes ExecCGI MultiViews
    AllowOverride None
    ExpiresActive on
    ExpiresDefault A15
    Order allow,deny
    Allow from all
  </Directory>

  Alias /perl/ "/export/home/[URL unfurl="true"]www1/perl/"[/URL]
  PerlModule Apache::Registry;
  <Location /perl/>
      SetHandler perl-script
      PerlHandler Apache::Registry
      Options +ExecCGI  
      PerlSendHeader On
      Allow from all
  </Location> 

  Alias /perl-admin/ "/export/home/[URL unfurl="true"]www1/perl-admin/"[/URL]
  PerlModule Apache::Registry;
  <Location /perl-admin/>
      SetHandler perl-script
      PerlHandler Apache::Registry
      Options +ExecCGI
      PerlSendHeader On
      Allow from all
  </Location>

  Alias /icons/ "/export/home/[URL unfurl="true"]www1/icons/"[/URL]
#  PerlSetEnv Icons /export/home/[URL unfurl="true"]www1/icons/[/URL]
  <Directory /export/home/[URL unfurl="true"]www1/icons>[/URL]
    Options MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  Alias /css/ "/export/home/[URL unfurl="true"]www1/css/"[/URL]
  <Directory /export/home/[URL unfurl="true"]www1/css>[/URL]
    Options MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  ScriptAlias /cgi-bin/ "/export/home/[URL unfurl="true"]www1/cgi-bin/"[/URL]
  PerlSetEnv CgiBin /export/home/[URL unfurl="true"]www1/cgi-bin/[/URL]
  <Directory /export/home/[URL unfurl="true"]www1/cgi-bin>[/URL]
    Options Includes ExecCGI MultiViews  
    AllowOverride None
    ExpiresActive on  
    ExpiresDefault A15
    Order allow,deny  
    Allow from all  
  </Directory>   

  Alias /jsdk/ "/export/home/abcd/Jsdk/"

  Alias /awstatsclasses "/usr/local/awstats/[URL unfurl="true"]wwwroot/classes/"[/URL]
  Alias /awstatscss "/usr/local/awstats/[URL unfurl="true"]wwwroot/css/"[/URL]
  Alias /awstatsicons "/usr/local/awstats/[URL unfurl="true"]wwwroot/icon/"[/URL]
  ScriptAlias /awstats/ "/usr/local/awstats/[URL unfurl="true"]wwwroot/cgi-bin/"[/URL]

   <Directory "/usr/local/awstats/[URL unfurl="true"]wwwroot">[/URL]
      AuthType Basic
      AuthName "Restricted"
      AuthUserFile /usr/local/awstats/.htpasswd
      Require valid-user
   </Directory>

  PerlSetVar DBI_USER xxxx
  PerlSetEnv DBI_USER xxxx
  PerlSetVar DBI_PASS xxxx
  PerlSetEnv DBI_PASS xxxx

  PerlSetVar AuthName xxxx
  PerlSetVar AuthType Authorize
  PerlSetVar Sitename [URL unfurl="true"]www1.xxxx.com[/URL]

  PerlTransHandler Apache::FP::Trans
  PerlAccessHandler Apache::FP::Access

</VirtualHost>

Disclaimer: Please realize that I did not create this file so don't chastise me if it's poorly written.
 
Oh, I know mod_perl is running on this server and being used if that helps...
 
I think you'd be quicker getting assistance in the Apache forum to be honest, but mention the fact you posted here first, and if possible link back to this post.

Regards
--Paul

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thanks Paul. I'll try that as well. I appreciate your help with this. :)
 
I figured it out. It had to do with the PerlAccessHandler Apache::FP::Access package. There was a call to a handler.cgi file that parsed each .htm* file for the <% perl pattern to make this work.

I was able to rewrite it for www2 and add it to its config file. It's all working perfectly now.

Thanks again for the attention, Paul.
 
yw, ;-)

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top