httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <>
Subject Re: [users@httpd] Conditional Blocks based upon Remote IP Address
Date Tue, 21 Oct 2008 15:16:01 GMT
On Tue 21 Oct 2008, Clint Priest wrote:
> When the php module is installed into apache there is a php_flag and
> php_value directive available which could be used to set the value
> from within Apache, the only trick is to only have them take effect
> for certain remote ips.  They would be:
> php_flag display_errors On
> php_flag display_startup_errors On

Provided these directives are allowed in a Directory block or .htaccess 
file you can do that if you have modperl installed:

package My::Fixup;
use strict;
use warnings;
use Apache2::RequestRec ();
use Apache2::Connection ();
use Apache2::Const -compile=>'OK';

sub handler {
  my $r=shift;
  if( $r->connection->remote_ip =~ /192\.168\.0\.\d+/ ) {
    $r->add_config(['php_flag display_errors On',
                    'php_flag display_startup_errors On'],
  return Apache2::Const::OK;
PerlFixupHandler My::Fixup

The string between the 2 slashes in the line with "->remote_ip" is a 
regular expression that matches your ip addresses.

See also and


Need professional mod_perl support?
Just hire me:

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message