1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Fatal Error: Call to undefined function: getallheaders()

Discussion in 'PHP' started by tb1234, Oct 9, 2007.

  1. #1
    Hi,

    I am getting following error while running script:

    Fatal error: Call to undefined function: getallheaders() ... in script

    I am using Apache/1.3.37 & PHP 4.4.4.

    I read in forums that problem is that php is not installed as a Apache Module.

    If this is the reason, how can I solve the problem? If any other problem then also suggest solution.

    Thanks in advance.
     
    tb1234, Oct 9, 2007 IP
  2. theOtherOne

    theOtherOne Well-Known Member

    Messages:
    112
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #2
    On php.net I found the following alternative to getallheaders() :
    
    <?php
    function emu_getallheaders() {
       foreach($_SERVER as $name => $value)
           if(substr($name, 0, 5) == 'HTTP_')
               $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
       return $headers;
    }
    ?>
    PHP:
    ...so if you declare this function you can use emu_getallheaders() instead of getallheaders().
     
    theOtherOne, Oct 9, 2007 IP
  3. kajakske

    kajakske Well-Known Member

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    165
    #3
    What exactly do you need ?

    SERVER variables are also available in $_SERVER, even if PHP isn't an apache module.
     
    kajakske, Oct 9, 2007 IP