PHP gotchas

From TNG_Wiki
Jump to navigation Jump to search

The following are some PHP changes or PHP gotchas that might cause some of your pages to quit working. Some suggested methods for handling in TNG are indicated.


$HTTP_GET_VARS

I have changed hosting provider and now the $HTTP_GET_VARS doesn't work any more in PHP? Could this be because of a different php version?

The current version of PHP does not support HTTP_GET_VARS[] by default where version 4 did.

Recommended action is to replace all instances of $HTTP_GET_VARS with $_GET


$HTTP_SERVER

I have changed hosting provider and now the $HTTP_SERVER doesn't work any more in PHP? Could this be because of a different php version?

The current version of PHP does not support HTTP_SERVER[] by default where version 4 did.

Recommended action is to replace all instances of $HTTP_GET_VARS with $_SERVER


$_SERVER

Note that on some hosts, the $_SERVER['HTTP_HOST'] == 'www.domain.com' might also fail because the www is now be stripped from the returned string.

Recommended action is to replace if ( $_SERVER['HTTP_HOST'] == 'www.yourdomain.com') with if ( $_SERVER['HTTP_HOST'] == 'www.yourdomain.com' || $_SERVER['HTTP_HOST'] == 'yourdomain.com') {