Azu Posted April 24, 2007 Share Posted April 24, 2007 Please tell me how I can use PHP to change the "Server" header that is sent to the client. I tried header("Server: ".rand(-5,5)); but for some reason it didn't work. ??? Quote Link to comment Share on other sites More sharing options...
Azu Posted April 26, 2007 Author Share Posted April 26, 2007 Bump ^^ please help.. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 26, 2007 Share Posted April 26, 2007 You will find a number of web sites that suggest that you can simply use the Header set notation to modify the Server header on Apache 2.0. This not true, If you're using Apache 1.3, the answer is that you have to edit the source code and recompile Apache. In particular, you'll need to edit the file src/include/httpd.h. Look for these lines: #define SERVER_BASEPRODUCT "Apache" #define SERVER_BASEREVISION "1.3.31" Change those to whatever amuses you. Recompile. For Apache 2.0, the situation is similar, but different. Edit the file include/ap_release.h and look for these lines: #define AP_SERVER_BASEPRODUCT "Apache" #define AP_SERVER_MAJORVERSION "2" #define AP_SERVER_MINORVERSION "0" #define AP_SERVER_PATCHLEVEL "50" If you happen to be running mod_security (you really should be), you can modify the Server header using the SecServerSignature directive: SecServerSignature "MadTechie/2.0 GoodLuck --MadTechie Quote Link to comment Share on other sites More sharing options...
Azu Posted May 2, 2007 Author Share Posted May 2, 2007 Thanks that isn't what I am looking for though. I am looking for a way to modify this header in PHP, dynamically, per page. I am not looking for a way to just remove some certain information, and for this change to always have to be applied exactly a certain way to every single page on my website including non-PHP pages, and can only use on a host that not only allows Apache to be used as the web server but also allows me to delete the apache executable file and replace it with my own, customized one (almost NO hosts will even consider allowing this). I have been searching for days and any help would be greatly appreciated. Again, I am looking for a way to do this in PHP. I just want to modify this header in PHP, just like I can modify other headers in PHP. I would also like to edit the Date header but this is not nearly as important. Thank you for taking the time to read this =D Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 2, 2007 Share Posted May 2, 2007 Please tell me how I can use PHP to change the "Server" header that is sent to the client. You CAN'T via a PHP script. Other headers you can change.. but good luck in your search. Quote Link to comment Share on other sites More sharing options...
Azu Posted May 2, 2007 Author Share Posted May 2, 2007 Hi, thanks for the reply! Can you please tell me why the header cannot be changed in PHP? And is there any PHP module that might let this be done? It would be so great if there was! Even if it isn't free, as long as it's not to expensive. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 2, 2007 Share Posted May 2, 2007 the only ways i know of are listed above, any module would have to be setup on the server, (so your need access to it), and if you have access then you could just use ServerSignature Off you could use modsecurity, but your have to readup on it see here find "Server identity masking" hope that helps as thats the best i can offer Quote Link to comment Share on other sites More sharing options...
Azu Posted May 2, 2007 Author Share Posted May 2, 2007 Aww.. so it's impossible to change the header without getting rid of the server core and replacing with another one? Okay.. thanks anyways ^^ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.