473,785 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A GREAT SUGGESTION TO PHP DEVELOPPERS

Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Locatio n: /my_internal_red irected_page.ph p");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Locatio n: /my_internal_red irected_page.ph p");
header("HTTP/1.0 200 OK");

If you put the Location header after the "HTTP/1.0 200 OK" header PHP
sends a 302 status without the Location header (no comment).

That reminds me Micro$oft programs that always know better what the user
wants to do than the user himself...

It is a pity which PHP behaves like micro$oft, if the programmer sends
stupid HTTP headers, PHP should let him do...

So I think that an option to let the programmer send all http headers
would be great, that way people who don't want to care about headers
won't have troubles and experimented programmers will be happy :)
I would like to thank all PHP developpers for their great work and I hope
they'll consider this suggestion ;)


John
PS: I posted this suggestion here because I don't know where to send
it... If someone knows a better place, please tell me.
Jul 17 '05
11 2080
On 22 mars 2004, Sir ng**********@re diffmail.com (R. Rajesh Jeba Anbiah)
claimed in news:ab******** *************** ***@posting.goo gle.com:


Sounds like you're referring the user notes by ahring.de
(02-Dec-2003 09:24) found at <http://in.php.net/header>

In that case, the following is working fine:

<?php
header("Locatio n: http://www.google.com" );
header("Status: 200");
?>


I tried that but it didn't work (302 was sent), at least with PHP 4.3.4 on
FreeBSD 4.9 STABLE, it seems that after a "Location" header, PHP only
considers 3xx status codes...
Jul 17 '05 #11
I agree and have made a similar comment before. There are
circumstances where it's desirable to take complete responsibility for
generating the full HTTP response including headers, but there's
currently no way of turning everything off. I hit against this problem
when doing R&D into a WebDAV implementation. In the end I had to
abandon the use of PHP as a gateway technology which was a great pity.
It seems that PHP adopts the "nanny knows best" attitude and assumes
responsibility in this area.

Rob
On 21 Mar 2004 21:36:13 -0800, ng**********@re diffmail.com (R. Rajesh
Jeba Anbiah) wrote:
John Wellesz <jo************ *************** **@firstream.ne t> wrote in message news:<Xn******* *************** @213.91.2.138>. ..
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Locatio n: /my_internal_red irected_page.ph p");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Locatio n: /my_internal_red irected_page.ph p");
header("HTTP/1.0 200 OK");


Sounds like you're referring the user notes by ahring.de
(02-Dec-2003 09:24) found at <http://in.php.net/header>

In that case, the following is working fine:

<?php
header("Locati on: http://www.google.com" );
header("Status : 200");
?>


---
Rob Tweed
M/Gateway Developments Ltd

Global DOMination with eXtc : http://www.mgateway.tzo.com
---
Jul 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2137
by: Alexander DEJANOVSKI | last post by:
Hi all, I'm starting a new project to develop an Open-Source EAI server in Python and I'm looking for motivated developpers and testers. It is inspired by Open Adaptor (www.openadaptor.org), but aims to be easier to use and more powerful. I've developped yet a first alpha that contains several components: File Source
0
3146
by: Willem | last post by:
Based on MK's TSI_SOON (http://www.trigeminal.com/)I've created a nifty little procedure that - whenever you compact you db you get an incremental backup copy. Given that you have a table with version information you get incremental backups on a per-version basis. SEE CODE BELOW Basic idea is: start TSISOON with the options: 1. "compact this db"
7
1973
by: J.Marsch | last post by:
I don't know whether this is the appropriate place to give product feedback, but here goes: I would love to see some kind of diagnostic to let me know when implicit boxing has occurred. We have had a few instances where one developer or another was working on code, and did not realize that by passing their value type to a method that accepted an object parameter (or in many cases, a delegate).
2
1637
by: Carlos Costa Portela | last post by:
Hello all! I've upgraded postgresql from 7.2 to 7.4, and my data dir has changed a lot: S.ficheros Tamaño Usado Disp Uso% Montado en /dev/hda1 1.9G 1.8G 64M 97% /usr/local/pgsql/data.old /dev/hdb2 4.5G 357M 3.9G 9% /usr/local/pgsql/data Is this normal? I've made some queries to the system and all the
17
1923
by: Jedrzej Miadowicz | last post by:
I recently (re)discovered data binding in Windows Forms thanks to its advances in Visual Studio 2005. As I looked a little deeper, however, I realize that it still suffers from an irksome tendency to stick a whole bunch of literal strings in my code. Quite frankly, I consider them a plague imposed on developers by the RAD designers that come with Visual Studio. The problem with using literal strings to refer to controls, data sources,...
10
1864
by: ravenwolf | last post by:
IT'S SIMPLE AND IT'S LEGAL!!!!!!! I found this on a bulletin board and decided to try it a little while back; I was browsing through news groups just as you are right now and came across an article similar to this saying that you could make thousands of dollars within weeks with only an initial investment of $6.00!! So, I thought yeah right. This must be a scam, but like most of us, I as curious, so I kept reading. Anyway, it said that you...
20
2190
by: Allan Ebdrup | last post by:
I have a suggestion for C# I would like reader/writer locks to be built in to the language. When you want to aquire a loct on an object o you write lock(o) { ...//critical region } I would like to be able to write: readlock(o)
0
845
by: Guilherme Polo | last post by:
On Mon, Sep 1, 2008 at 3:35 PM, <dudeja.rajat@gmail.comwrote: Note that you are not supposed to use _show, use showerror here instead. Remove the call to sys.exit then ? Your ask for a suggestion doesn't make much sense to me, try writing what are you trying to achieve.
6
2268
by: Tony Johansson | last post by:
Hello! We have a C#.ASP.NET application that runs on a IIS 6. The application contains actually several asp pages but there is no GUI. The application receive an xml file that is processed. There is also an MFC dll that is called from this asp application to make a syntax check on quite many commands. You don't have to know what a command is. The problem that we get is the following when the asp pages calls the MFC
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.