PHP Classes

Web Server Info: Fix request values to work with different servers

Recommend this page to a friend!
  Info   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 38%Total: 1,472 This week: 2All time: 2,653 This week: 96Up
Version License Categories
webserverinfo 1.0GNU Lesser Genera...HTTP, System information
Description 

Author

This class can be used to fix the values of super-global variables so they have the same values independently of the Web server.

It can:

- Fixes PATH_TRANSLATED variable to use only / as path separator
- Set the REQUEST_URI to SCRIPT_NAME or QUERY_STRING when the REQUEST_URI is not set
- Set the SERVER_SIGNATURE with values based on SERVER_SOFTWARE, SERVER_NAME, and SERVER_PORT when SERVER_SIGNATURE is not set
- Set SCRIPT_FILENAME based on PATH_TRANSLATED when SCRIPT_FILENAME is not set
- Set DOCUMENT_ROOT based on REQUEST_URI and PATH_TRANSLATED when DOCUMENT_ROOT is not set

Innovation Award
PHP Programming Innovation award winner
November 2006
Winner


Prize: One copy of the Zend Studio
PHP can run with different Web servers in different modes. Each Web server may set different environment variables with details about each HTTP request. This makes more difficult to develop Web server independent applications.

This class provides a solution to this problem. It rewrites certain PHP super-globals that store environment variables set by the Web server.

This way, applications do not need to be adapted to run with different Web servers.

Manuel Lemos
Picture of Svetoslav Marinov
  Performance   Level  
Name: Svetoslav Marinov <contact>
Classes: 7 packages by
Country: Canada Canada
Age: 42
All time rank: 715 in Canada Canada
Week rank: 106 Down3 in Canada Canada Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Details

WebServerInfo PHP class Introduction ============================================ WebServerInfo PHP class is intended for developer who create software that will run on different web servers. This PHP class gives a developer an universal interface for accessing web server's variables. Usage: ============================================ You have following options: Option #1 require_once("WebServerInfo.class.php"); $obj = new WebServerInfo(); print $_SERVER['DOCUMENT_ROOT']; Option #2 require_once("WebServerInfo.class.php"); $obj = new WebServerInfo(); print $obj->get('DOCUMENT_ROOT'); Option #3 uncomment the 3rd line from WebServerInfo.class.php and all you have to do is require the WebServerInfo.class.php class. Note: The constructor of WebServerInfo class overrides $_SERVER variable and variables can be accessed as usual way. Following base variables are exported if they do not exist. REQUEST_URI REDIRECT_URL DOCUMENT_ROOT SERVER_SIGNATURE SERVER_ADDR SCRIPT_FILENAME License: ============================================ see LICENSE Bugs/Comments/Ideas ============================================ if you intend to use this class in your software or have some great ideas feel free to contact me. Donations ============================================ Donations are always highly appreciated but not mandatory. If you would like to support my work please contact me in order to discuss available payment options. Author ============================================ Svetoslav Marinov is studying computer sciences and technologies in technical university of Sofia, Bulgaria. He is working on a SEO Filter project. SEO Filter stands for Search Engine Optimization Software for forums such as PunBB, phpBB2 etc. User does not need to hack his forum in order to make it SEO friendly. For more information go to: http://seofilter.com Svetoslav Marinov svetoslavm#gmail.com (c) November 19th, 2006 All rights reserved.

  Files folder image Files  
File Role Description
Accessible without login Plain text file example1.php Example example1
Accessible without login Plain text file example2.php Example example2
Accessible without login Plain text file example3.php Example example3
Accessible without login Plain text file LICENSE Lic. LICENSE
Accessible without login Plain text file README Doc. README
Plain text file WebServerInfo.class.php Class WebServerInfo class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,472
This week:2
All time:2,653
This week:96Up
 User Ratings  
 
 All time
Utility:50%StarStarStar
Consistency:43%StarStarStar
Documentation:43%StarStarStar
Examples:50%StarStarStar
Tests:-
Videos:-
Overall:38%StarStar
Rank:3891