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

Web Hosting - 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 home directory path looks like ~/public_html/yourapp/ but after it is proxied to, the /pubweb/~yourID/ path segment is removed. Thus, references to ~/public_html/yourapp/ and 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.

    Ref: PHP $_SERVER

    Example output


        [SCRIPT_URL] => /~unixid/php.php Path missing /pubweb relative to
        [SCRIPT_URI] =>
        [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_MAX_FORWARDS] => 10
        [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] => 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
        [GATEWAY_INTERFACE] => CGI/1.1
        [SERVER_PROTOCOL] => HTTP/1.1
        [QUERY_STRING] =>
        [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)

    Other $GLOBALS

        [_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

    See Also