The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using the PHP header() function in cPanel

Discussion in 'cPanel Developers' started by RSimoes, Nov 7, 2008.

  1. RSimoes

    RSimoes Member
    PartnerNOC

    Joined:
    Oct 9, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Austin, TX
    It seems that the cPanel http daemon kills any attempt to send out a Location header. For example, if I have a PHP file with just the following:

    Code:
    <?
    header('Location: http://www.cpanel.net');
    ?>
    
    The page will fail to redirect and output the following:

    The same PHP file executed by PHP/Apache will redirect as expected. I have to admit this one is completely throwing me for a loop. Anyone have an explanation for this? :confused:
     
  2. RSimoes

    RSimoes Member
    PartnerNOC

    Joined:
    Oct 9, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Austin, TX
    As a somewhat insane workaround (meta refresh aside), it turns out that placing the same file outside the frontend directory (i.e., in /usr/local/cpanel/base) will prevent cPanel from intercepting the Location header. :cool:
     
Loading...

Share This Page