# Help with php header

**URL:** <https://forum.kirupa.com/t/help-with-php-header/63101>\
**Category:** Uncategorized\
**Created:** [September 2, 2004, 11:40pm UTC](https://forum.kirupa.com/t/help-with-php-header/63101 "2004-09-02T23:40:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![meatcake](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@meatcake](https://forum.kirupa.com/u/meatcake)\
**Post date:** [September 2, 2004, 11:40pm UTC](https://forum.kirupa.com/t/help-with-php-header/63101/1 "2004-09-02T23:40:19Z")

</div>

every time I try using header(“Location:[http://whatever](http://whatever) whatever”)

or any other kind of php header, the browser says

“headers already set cannot set headers”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 7, 2004, 9:26am UTC](https://forum.kirupa.com/t/help-with-php-header/63101/2 "2004-09-07T09:26:45Z")

</div>

I think this would be better off in the Server-Side forum as PHP is server-side and not client-side.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 7, 2004, 9:48am UTC](https://forum.kirupa.com/t/help-with-php-header/63101/3 "2004-09-07T09:48:05Z")

</div>

> [@meatcake](#):
>
> every time I try using header(“Location:[http://whatever](http://whatever) whatever”)
> 
> or any other kind of php header, the browser says
> 
> “headers already set cannot set headers”

You need to put the header: line at the very start of the document - like literally, the very first line.

Or you could use output buffering. Check the manual page for ob\_start ([PHP: ob\_start - Manual](http://php.net/ob_start)) for details.
