Click here to get back home

Sending headers in PHP under Godaddy linux hosting

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Sending headers in PHP under Godaddy linux hosting Webrickco 07-12-2008
Get Chitika Premium
Posted by Webrickco on July 12, 2008, 9:12 pm
Please log in for more thread options
Hi,

I have the following issue when i upload my files to my hosting. I
cannot send the following headers:

<?php
header('Content-Type: text/xml');
header('Pragma: no-cache');

When I execute the code, I get:

Warning: Cannot modify header information - headers already sent by
(output started at /home/content/d/a/v/davidc2p/html/testajax.php:1)
in /home/content/d/a/v/davidc2p/html/testajax.php on line 1

Warning: Cannot modify header information - headers already sent by
(output started at /home/content/d/a/v/davidc2p/html/testajax.php:1)
in /home/content/d/a/v/davidc2p/html/testajax.php on line 2

Notice that this code works perfectly on my local server because I
have added PHP_FLAG output_buffering on in my .htaccess file.

If I do this on my remote server, nothing happens and i continue to
have those 2 warnings. I also tried to use this command in the php.ini
file and nothing happened.

Can someone help me on that matter? I would really appreciate.


Posted by Michael Fesser on July 12, 2008, 10:40 pm
Please log in for more thread options
.oO(Webrickco)

>I have the following issue when i upload my files to my hosting. I
>cannot send the following headers:
>
><?php
>header('Content-Type: text/xml');
>header('Pragma: no-cache');
>
>When I execute the code, I get:
>
>Warning: Cannot modify header information - headers already sent by
>(output started at /home/content/d/a/v/davidc2p/html/testajax.php:1)
>in /home/content/d/a/v/davidc2p/html/testajax.php on line 1
>
>Warning: Cannot modify header information - headers already sent by
>(output started at /home/content/d/a/v/davidc2p/html/testajax.php:1)
>in /home/content/d/a/v/davidc2p/html/testajax.php on line 2
>
>Notice that this code works perfectly on my local server because I
>have added PHP_FLAG output_buffering on in my .htaccess file.

You should _disable_ output buffering and fix your code instead.
Check what causes the output and rethink the code structure.

Micha

Posted by Geoff Berrow on July 13, 2008, 4:02 am
Please log in for more thread options
Message-ID:
Webrickco contained the following:

>Warning: Cannot modify header information - headers already sent by
>(output started at /home/content/d/a/v/davidc2p/html/testajax.php:1)
>in /home/content/d/a/v/davidc2p/html/testajax.php on line 1

What's on line 1? Is it perhaps a blank line?

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
http://slipperyhill.co.uk
100110001101101111001011100111010101101011

Posted by Webrickco on July 13, 2008, 7:00 am
Please log in for more thread options
I don't think I'm am sending any blank line, or any output before my
first header, otherwise, it wouldn't be working on my local server
right? In order to make it work on my local server, I had to complete
the .htaccess file with PHP_FLAG output_buffering on.

When I do the same on my remote server, it simply doesn't work, and
send the warnings described above.
Any idea why?

Posted by Geoff Berrow on July 13, 2008, 7:07 am
Please log in for more thread options
Message-ID:
Webrickco contained the following:

>I don't think I'm am sending any blank line, or any output before my
>first header, otherwise, it wouldn't be working on my local server

Well you are obviously outputting headers! If not a blank line what
about an error notice before you send your headers?





--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk

Similar ThreadsPosted
PHP sending whitespace after headers? August 24, 2006, 1:11 pm
(OT) 300-500 GB of hosting. That opinion. Truth or lie? My english not is good. 300 a 500 GB de hosting. Que opinan. Verdad o mentira? October 16, 2007, 2:43 pm
300-500 GB of hosting. It is not advertising. I really doubt if the service is good. Alquian have 300 a 500 GB de hosting. Que opinan. Verdad o mentira? October 22, 2007, 3:42 pm
Headers - returning specified HTTP headers from a POST August 11, 2005, 11:56 am
If you wish to have a professional shared hosting quality in a free hosting package, come and host with 000webhost.com and experience the best service you can get absolutely free. July 2, 2008, 9:04 pm
If you wish to have a professional shared hosting quality in a free hosting package, come and host with 000webhost.com and experience the best service you can get absolutely free. July 9, 2008, 7:56 pm
error with sessions and headers being sent, yet nothing but headers have been sent June 2, 2005, 2:01 pm
PHP, Curl and GoDaddy May 8, 2005, 11:12 pm
Are you a GoDaddy user? April 8, 2008, 1:25 am
[News] [Linux] Firefox for Linux Could Soon Be Improved at Expense. May 30, 2007, 5:47 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap