Content | Navigation |

PHP environment in Pubweb

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.

Reference Description of core php.ini directives (short_open_tag)

$_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.phpPath missing /pubweb relative to[SCRIPT_URI] =>[HTTP_HOST] => 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
    [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_NAME] =>
    [SERVER_ADDR] =>	Pubweb's address[SERVER_PORT] => 8080Pubweb'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.phpPubweb path
    [REMOTE_PORT] => 48181
    [QUERY_STRING] =>[REQUEST_URI] => /%7Eunixid/php.phpPubweb address[SCRIPT_NAME] => /~unixid/php.phpPubweb address[PHP_SELF] => /~unixid/php.phpPubweb address
    [REQUEST_TIME] => 1259350556


NULL (this is deprecated)


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

Student Focused. Land Grant. Research University.

Follow NDSU
  • Facebook
  • Twitter
  • RSS
  • Google Maps

North Dakota State University
Phone: +1 (701) 231-7961 / Fax: (701) 231-8541
Campus address: Quentin Burdick Building 206
Physical/delivery address: 1320 Albrecht Blvd., Fargo, ND 58102
Mailing address: NDSU Dept. 4530 / PO Box 6050 / Fargo, ND 58108-6050
Page manager: ECI Contacts Page

Last Updated: Thursday, January 28, 2016 4:24:56 PM
Privacy Statement