Re: [PHP] Sending headers to server
On Sat, Aug 3, 2013 at 11:46 AM, Karim Geiger wrote: > Am 02.08.13 18:03, schrieb Miguel Guedes: > > This is strange. I've just found out that the headers are sent > > correctly if I access the website outside of localhost. I don't > > understand why. > > I also don't. I've tried the exactly same code you posted on my > localhost as well and it worked all properly. Weird behaviour, can > anyone explain why this happens? > > Regards > > Karim > Could it be that you're actually ending up with a different site because you have configured your vhost to a certain domain? - Matijn
Re: [PHP] Sending headers to server
Am 02.08.13 18:03, schrieb Miguel Guedes: > This is strange. I've just found out that the headers are sent > correctly if I access the website outside of localhost. I don't > understand why. I also don't. I've tried the exactly same code you posted on my localhost as well and it worked all properly. Weird behaviour, can anyone explain why this happens? Regards Karim -- Karim Geiger Auszubildender Fachinformatiker AE B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 signature.asc Description: OpenPGP digital signature
Re: [PHP] Sending headers to server
This is strange. I've just found out that the headers are sent correctly if I access the website outside of localhost. I don't understand why. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending headers to server
Hi Miguel, On 08/02/2013 04:34 PM, Miguel Guedes wrote: > > Here's my output: > > $ curl -v http://localhost/header-test.php > * About to connect() to localhost port 80 (#0) > * Trying 127.0.0.1... > * Connected to localhost (127.0.0.1) port 80 (#0) >> GET /header-test.php HTTP/1.1 >> User-Agent: curl/7.29.0 >> Host: localhost >> Accept: */* >> > < HTTP/1.1 200 OK > < Date: Fri, 02 Aug 2013 14:32:47 GMT > < Server: Apache/2.2.22 (Ubuntu) > < X-Powered-By: PHP/5.4.9-4ubuntu2.2 > < Status: 500 Internal Server Error > < Vary: Accept-Encoding > < Content-Length: 0 > < Content-Type: text/html > < > * Connection #0 to host localhost left intact > > Using the following test script: > > > header('Status: 500 Internal Server Error'); > header('HTTP/1.1 500 Internal Server Error', true, 500); > > ?> allright, that's weird. I'm currently not able to reproduce your problem but I've found out that some others are experiencing the same problem like you do. They found this solution to work: header($_SERVER["SERVER_PROTOCOL"] . 'HTTP/1.1 500 Internal Server Error'); Might try this one.. Regards Karim -- Karim Geiger Auszubildender Fachinformatiker AE B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 signature.asc Description: OpenPGP digital signature
Re: [PHP] Sending headers to server
Great tip, Karim! On 02/08/13 15:29, Karim Geiger wrote: Try getting the complete header by using curl -v http://url.com and paste it here. What is your output? Here's my output: $ curl -v http://localhost/header-test.php * About to connect() to localhost port 80 (#0) * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 80 (#0) > GET /header-test.php HTTP/1.1 > User-Agent: curl/7.29.0 > Host: localhost > Accept: */* > < HTTP/1.1 200 OK < Date: Fri, 02 Aug 2013 14:32:47 GMT < Server: Apache/2.2.22 (Ubuntu) < X-Powered-By: PHP/5.4.9-4ubuntu2.2 < Status: 500 Internal Server Error < Vary: Accept-Encoding < Content-Length: 0 < Content-Type: text/html < * Connection #0 to host localhost left intact Using the following test script: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending headers to server
Hi Miguel, On 08/02/2013 10:50 AM, Miguel Guedes wrote: > Hi Karim, > > On 01/08/13 15:40, Karim Geiger wrote: >> >> Works for me. What happens exactly? Do you get a 200? >> > > That's exactly right - I always get a 200. How can I diagnose this? > Try getting the complete header by using curl -v http://url.com and paste it here. In my example I'm getting this output: * About to connect() to ** port 80 (#0) * Trying 213.***.***.***... * Connected to ** (213.***.***.***) port 80 (#0) > GET /test.php HTTP/1.1 > User-Agent: curl/7.29.0 > Host: ** > Accept: */* > < HTTP/1.1 500 Internal Server Error < Date: Fri, 02 Aug 2013 14:27:15 GMT < Server: Apache < Content-Length: 6 < Connection: close < Content-Type: text/html; charset=UTF-8 < * Closing connection 0 What is your output? Regards Karim -- Karim Geiger Auszubildender Fachinformatiker AE B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 signature.asc Description: OpenPGP digital signature
Re: [PHP] Sending headers to server
On 02/08/13 14:10, Matijn Woudt wrote: Did you print some data before using header? No, not at all. I've PHP configured to complain about notices, warnings and errors; would've got a warning about headers already sent, which I don't get. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending headers to server
On Thu, Aug 1, 2013 at 4:04 PM, Miguel Guedes wrote: > Hello List, > > > I'm running PHP 5.4.9 as CGI (via apache 2.2.22) and can't seem to be > able to send headers to the server. > > Both, > > header('Status: 500 Internal Server Error'); > > and, > > header('HTTP/1.1 500 Internal Server Error', true, 500); > > result in nothing happening on the client side. > > What am I missing? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Did you print some data before using header? - Matijn
Re: [PHP] Sending headers to server
Hi Karim, On 01/08/13 15:40, Karim Geiger wrote: Works for me. What happens exactly? Do you get a 200? That's exactly right - I always get a 200. How can I diagnose this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending headers to server
Hi MiguelOn 08/01/2013 04:04 PM, Miguel Guedes wrote: > Hello List, > > > I'm running PHP 5.4.9 as CGI (via apache 2.2.22) and can't seem to be > able to send headers to the server. > > Both, > > header('Status: 500 Internal Server Error'); > > and, > > header('HTTP/1.1 500 Internal Server Error', true, 500); > > result in nothing happening on the client side. > > What am I missing? > Works for me. What happens exactly? Do you get a 200? Karim -- Karim Geiger Auszubildender Fachinformatiker AE B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 signature.asc Description: OpenPGP digital signature
[PHP] Sending headers to server
Hello List, I'm running PHP 5.4.9 as CGI (via apache 2.2.22) and can't seem to be able to send headers to the server. Both, header('Status: 500 Internal Server Error'); and, header('HTTP/1.1 500 Internal Server Error', true, 500); result in nothing happening on the client side. What am I missing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sending headers
> I try to include a redirect header in my script, but is fails with the > familiar ( headers already sent) error. > > I KNOW you should put the headers call where it will cause the first > output, and I do that, the only thing happening infront of the headers > call is an include statement to my main db class; this class has > absolutely NO output unless a function is called (which it is not)... > > What am I missing? The error message tells you exactly what you need to know. "Output started at xxx.php:12" or something similar. That gives you the file name and line number where "output" was started. Begin your troubleshooting there. Ensure you don't have any whitespace before or after the opening/closing tags (like an extra newline at the end of the included file). ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sending headers
> Hi List > > I am having trouble using headers. > > I try to include a redirect header in my script, but is fails with the > familiar ( headers already sent) error. > > I KNOW you should put the headers call where it will cause the first > output, and I do that, the only thing happening infront of the headers > call is an include statement to my main db class; this class has > absolutely NO output unless a function is called (which it is not)... > > What am I missing? Hi too May be spaces/empty lines before/after . -- Mario Oberrauch --- CREATO - creative online systems - Spindler KEG Hafenstrasse 47 - 51, 4020 Linz, Austria Tel: +43 (0) 732/9015 5940 Fax: +43 (0) 732/9015 5949 Email:[EMAIL PROTECTED] --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sending headers
Hi List I am having trouble using headers. I try to include a redirect header in my script, but is fails with the familiar ( headers already sent) error. I KNOW you should put the headers call where it will cause the first output, and I do that, the only thing happening infront of the headers call is an include statement to my main db class; this class has absolutely NO output unless a function is called (which it is not)... What am I missing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php