Topics Map > Services > Communication and Collaboration Tools (Web, Video, Voice, Storage) > Web Publishing

Web Hosting - PHP Environment in Pubweb

Notice: If you are looking for resources on HyFlex teaching, please visit our Teach HyFlex Page

If you have done PHP development work in other environments, you should know about the following PHP environment gotchas on Pubweb.

Short open tags <? 

Short open tags (<? as opposed to <?php) are not enabled on Pubweb. 

This means you may need to modify old code or code you have borrowed or downloaded from other sources. When <? is used, the page is treated like XML and you will see the PHP code when visiting the page from a Web browser. Change these to <?php to make your pages parseable as PHP. 

Be sure to search and replace through all of your code, not only the first instance in each file. 

$_SERVER (server variables) 

On Pubweb, use of SERVER variables (especially those that refer to host, port, path) will be wrong. 


On Pubweb, your path looks like ~/public_html/yourapp/ 
but after it is proxied to the /pubweb/~yourID/ are removed. Thus, references to 
~/public_html/yourapp/ or are incorrect. 

Instead, you should configure your application using the paths that will exist after the proxy. The nature of this varies per site, depending whether you have an enhanced site, and per SERVER variable. 

$HTTP_SERVER_VARS is not available at all. If you see instances of $HTTP_SERVER_VARS in your code, you should update with the $_SERVER format. 

Example output 


[SCRIPT_URL] => /~unixid/php.php Path missing /pubweb relative to 
[HTTP_HOST] => Will be incorrect relative to 
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729) 
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5 
[HTTP_ACCEPT_ENCODING] => gzip,deflate 
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 
[HTTP_COOKIE] => Cookie info for 
[HTTP_CACHE_CONTROL] => max-age=0 
[HTTP_X_FORWARDED_FOR] => IP address of the actual "person" visiting the proxied address [HTTP_X_FORWARDED_HOST] => 
[PATH] => /sbin:/usr/sbin:/bin:/usr/bin 
[SERVER_SIGNATURE] => Apache/2.2.3 (Red Hat) Server at Port 8080 
[SERVER_SOFTWARE] => Apache/2.2.3 (Red Hat) 
[SERVER_ADDR] => Pubweb's address 
[SERVER_PORT] => 8080 Pubweb's port 
[REMOTE_ADDR] => address, not the "person" visitor 
[DOCUMENT_ROOT] => /var/www/html Doesn't reference your home dir. as root 
[SERVER_ADMIN] => root@localhost 
[SCRIPT_FILENAME] => /home/unixid/public_html/php.php Pubweb path 
[REMOTE_PORT] => 48181 
[REQUEST_URI] => /%7Eunixid/php.php Pubweb address 
[SCRIPT_NAME] => /~unixid/php.php Pubweb address 
[PHP_SELF] => /~unixid/php.php Pubweb address 
[REQUEST_TIME] => 1259350556 


NULL (this is deprecated) 


[_POST] => Array 
As appropriate 
[_GET] => Array 
As appropriate 
[_COOKIE] => Array 
[PHPSESSID] => ... 
[_FILES] => Array 
As appropriate 
[php_errormsg] => Undefined variable: HTTP_SERVER_VARS Present here because this script last tried to reference $HTTP_SERVER_VARS )

Keywords:pub, host, publish, publishing, website   Doc ID:103451
Owner:Michael R.Group:IT Knowledge Base
Created:2020-06-29 16:10 CDTUpdated:2020-08-24 14:38 CDT
Sites:IT Knowledge Base
Feedback:  0   0