Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    51
    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:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. RSimoes

    RSimoes Member
    PartnerNOC

    Joined:
    Oct 9, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    51
    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:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice