You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by abhishek jain <ma...@ejain.com> on 2008/01/24 02:11:56 UTC

[users@httpd] PerlSetEnv in .htaccess ?

Hi Friends,
I am using a shared hosting a/c and it allows me to use .htaccess
now i am writing the following lines in .htaccess and then the server is
giving the 500 internal server error

 PerlSetEnv EMBPERL_OBJECT_BASE _base.epl

Is there a method to write the code in another way so that the server allows
it in .htaccess .
Thanks,
abhi

Re: [users@httpd] PerlSetEnv in .htaccess ?

Posted by Torsten Foertsch <to...@gmx.net>.
On Thu 24 Jan 2008, abhishek jain wrote:
> > The server might not have mod_perl support and that's why it could make
> > that error.
>
> Hi, i do not have access to error log as well, i am on a shared hosting,

I really doubt that a shared hoster that denies access to the error_log 
supports mod_perl. Even if so Embperl at least with mp2.x requires an extra 
LoadModule. To check if your server supports mod_perl at first I'd check the 
ServerTokens it sends with each reply:

curl -I http://localhost
HTTP/1.1 200 OK
Date: Thu, 24 Jan 2008 08:07:34 GMT
Server: Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8e DAV/2 SVN/1.4.5 
mod_apreq2-20051231/2.6.0 mod_perl/2.0.4-dev Perl/v5.8.8

You see my localhost supports mod_perl version 2.0.4-dev. If it reads only

Server: Apache

then the administrator has configured the minimal server tokens. That does not 
mean you don't have mod_perl.

The next step would be a simple PerlResponseHandler something like that in 
your .htaccess (in case of mp2):

PerlResponseHandler "sub { \
  use Apache2::RequestRec; \
  use Apache2::RequestIO; \
  $_[0]->content_type( q{text/plain} ); \
  $_[0]->print(qq{OK\\n}); \
  return 0; \
}"

All untested of course. Try it first on a local host where you are sure you 
have mod_perl and access to the error_log.

If that works you have mod_perl2. But Embperl is another problem.

Torsten

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PerlSetEnv in .htaccess ?

Posted by abhishek jain <ma...@ejain.com>.
On 1/24/08, Octavian Rasnita <or...@gmail.com> wrote:
>
>  *From:* abhishek jain <ma...@ejain.com>
>
>
>
> > Hi Friends,
> > I am using a shared hosting a/c and it allows me to use .htaccess
> > now i am writing the following lines in .htaccess and then the server is
> giving the 500 internal server error
> >  PerlSetEnv EMBPERL_OBJECT_BASE _base.epl
>
> Check the error log in order to see what's the problem.
>
> The server might not have mod_perl support and that's why it could make
> that error.
>
> Octavian
>
>
>
Hi, i do not have access to error log as well, i am on a shared hosting,
abhi

Re: [users@httpd] PerlSetEnv in .htaccess ?

Posted by Octavian Rasnita <or...@gmail.com>.
From: abhishek jain 


  > Hi Friends,
  > I am using a shared hosting a/c and it allows me to use .htaccess
  > now i am writing the following lines in .htaccess and then the server is giving the 500 internal server error
  >  PerlSetEnv EMBPERL_OBJECT_BASE _base.epl

  Check the error log in order to see what's the problem.

  The server might not have mod_perl support and that's why it could make that error.

  Octavian

Re: [users@httpd] Re: PerlSetEnv in .htaccess ?

Posted by Scott Gifford <sg...@suspectclass.com>.
"abhishek jain" <ma...@ejain.com> writes:

> On second thoughts is there a method by which i can execute some
> piece of code to execute even before my scripts are called, remember
> i am on a shared host,

I don't know of a way to do exactly this on a shared host.  If your
provider supports mod_perl they must support things like PerlSetEnv,
you really should talk to them and see what they say.

Setting the environment variable in a BEGIN block of your Perl code
might be enough to work, though.

Good luck,

----Scott.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: PerlSetEnv in .htaccess ?

Posted by Dragon <dr...@crimson-dragon.com>.
abhishek jain wrote:

>On second thoughts is there a method by which i can execute some 
>piece of code to execute even before my scripts are called, remember 
>i am on a shared host,
>abhi
---------------- End original message. ---------------------

Child Perl programs inherit the environment of their parent, so 
setting the variable in a wrapper before calling the other script would work.

The best way is to get your hosting provider to help you set what you 
need in the main httpd.conf but if they won't do that, this will work.



Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: PerlSetEnv in .htaccess ?

Posted by abhishek jain <ma...@ejain.com>.
On second thoughts is there a method by which i can execute some piece of
code to execute even before my scripts are called, remember i am on a shared
host,
abhi

On 1/24/08, abhishek jain <ma...@ejain.com> wrote:
>
>
>
> On 1/24/08, Scott Gifford <sg...@suspectclass.com> wrote:
> >
> > You could try just using SetEnv.
>
>
> Yes i tried but this was also not working, a 500 internal server error
> appears,
>
> You could also edit your scripts to begin with:
> >
> >    $ENV{EMBPERL_OBJECT_BASE}='_base.epl'
>
>
> Actually i want this variable be set even before my code starts actually
> this is the code of a Perl template engine called Embperl, it needs to be
> there before any line of code,
>
> Are you using mod_perl or standard CGI scripts?
>
>
> I believe i am using modperl , but am not sure,
>
> There might be a better way supported by your Web hosting provider;
> > you could ask them for their suggestions.
>
>
>
>
> Good luck!
>
>
> Thanks a lot, and still i am struggling,
> abhishek jain
>
> ----Scott.
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> > Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>

Re: [users@httpd] Re: PerlSetEnv in .htaccess ?

Posted by abhishek jain <ma...@ejain.com>.
On 1/24/08, Scott Gifford <sg...@suspectclass.com> wrote:
>
> You could try just using SetEnv.


Yes i tried but this was also not working, a 500 internal server error
appears,

You could also edit your scripts to begin with:
>
>    $ENV{EMBPERL_OBJECT_BASE}='_base.epl'


Actually i want this variable be set even before my code starts actually
this is the code of a Perl template engine called Embperl, it needs to be
there before any line of code,

Are you using mod_perl or standard CGI scripts?


I believe i am using modperl , but am not sure,

There might be a better way supported by your Web hosting provider;
> you could ask them for their suggestions.




Good luck!


Thanks a lot, and still i am struggling,
abhishek jain

----Scott.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Re: PerlSetEnv in .htaccess ?

Posted by Scott Gifford <sg...@suspectclass.com>.
"abhishek jain" <ma...@ejain.com> writes:

> Pl. do not mind i am posting again within an hour, but the problem is taking my
> nerves, is there a way to go forward i believe the webhost is not allowing to
> set me PerlSetEnv is there another method to do the same,

You could try just using SetEnv.

You could also edit your scripts to begin with:

    $ENV{EMBPERL_OBJECT_BASE}='_base.epl'

Are you using mod_perl or standard CGI scripts?

There might be a better way supported by your Web hosting provider;
you could ask them for their suggestions.

Good luck!

----Scott.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: PerlSetEnv in .htaccess ?

Posted by abhishek jain <ma...@ejain.com>.
Pl. do not mind i am posting again within an hour, but the problem is taking
my nerves, is there a way to go forward i believe the webhost is not
allowing to set me PerlSetEnv is there another method to do the same,

Expecting replies,
abhi


On 1/24/08, abhishek jain <ma...@ejain.com> wrote:
>
> Hi Friends,
> I am using a shared hosting a/c and it allows me to use .htaccess
> now i am writing the following lines in .htaccess and then the server is
> giving the 500 internal server error
>
>  PerlSetEnv EMBPERL_OBJECT_BASE _base.epl
>
> Is there a method to write the code in another way so that the server
> allows it in .htaccess .
> Thanks,
> abhi
>