+ Reply to Thread
Results 1 to 8 of 8

Thread: PHP header() problems

  1. #1
    Harlan is offline x10Hosting Member Harlan is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    3

    PHP header() problems

    Relevant Info: adfree subdomain @ exofire.net, on STARKA server(I'm assuming it's a server?)

    Problem:
    test.php won't work.

    test.php: Simply consists of..
    Code:
    <?php
    header("Location: login.php");
    ?>
    Error Message:
    Warning: Cannot modify header information - headers already sent by (output started at /home/harlanw/public_html/test.php:1) in /home/harlanw/public_html/test.php on line 2
    I'm assuming that there's a setting/default on the subdomains that is messing the header() function up; I just don't know what it is.

    Anyone know what could be wrong?

  2. #2
    LHVWB's Avatar
    LHVWB is offline Lord Of The Keys LHVWB is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Australia
    Posts
    1,308

    Re: PHP header() problems

    That sort of error usually occurs because you have a space before your '<?php' tag. Check that you have no empty space there. You could also check the encoding of that file, sometimes if you are using the wrong encoding in your text then there can be some text before that tag when you save it.

  3. #3
    Harlan is offline x10Hosting Member Harlan is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    3

    Re: PHP header() problems

    I've checked both of course.

    Could you make your own test.php and see if it works?

  4. #4
    LHVWB's Avatar
    LHVWB is offline Lord Of The Keys LHVWB is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Australia
    Posts
    1,308

    Re: PHP header() problems

    http://lhvwb.verbtest.com/test.php

    I am on a different server (Absolut.x10), but it works fine for me.

  5. #5
    Harlan is offline x10Hosting Member Harlan is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    3

    Re: PHP header() problems

    Wanna try sending me your test.php.

    Send it to harlanwaldrop@gmail.com

  6. #6
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP header() problems

    Try to write a completely knew test.php file.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  7. #7
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: PHP header() problems

    Put ALL your PHP code before the website. The header must be called before the browser interprets the page.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  8. #8
    akkudreamz's Avatar
    akkudreamz is offline x10 Sophmore akkudreamz is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Jaipur, Rajasthan, India
    Posts
    183

    Re: PHP header() problems

    If you intend to redirect to another page i won't suggest you using that way
    use something like this

    PHP Code:

    function redirect($time,$topage)
    {
        echo 
    "<meta http-equiv='refresh' content='{$time}; url={$topage}' /> ";
        exit();


    $time is the number of seconds to wait before redirecting
    $page is the url of the page to redirect to

    now all you need to is

    PHP Code:
    redirect(0,"login.php"); 
    Last edited by akkudreamz; 02-28-2009 at 10:08 AM.
    Be safety conscious. 80% of people are caused by accidents.
    My Weblog

+ Reply to Thread

Similar Threads

  1. PHP Problems
    By Parsa44 in forum Programming Help
    Replies: 2
    Last Post: 02-21-2009, 10:01 AM
  2. Lotus - Apache & Blank PHP Problems
    By Compu in forum Free Hosting
    Replies: 1
    Last Post: 11-16-2008, 05:18 PM
  3. currently have an application pending php
    By biomasti in forum Free Hosting
    Replies: 1
    Last Post: 09-03-2008, 01:58 PM
  4. Still have problems with website after php change
    By melp57 in forum Free Hosting
    Replies: 5
    Last Post: 09-24-2007, 03:19 PM
  5. Php problems with eval function and uploads
    By carlos in forum Free Hosting
    Replies: 1
    Last Post: 09-24-2007, 08:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers