代码在托管服务器中工作时未定义的变量

Trying to help someone with their php based site, I cannot run it locally as I get errors for 'Undefined variable: dbhost' etc. when trying to use any page that connects to mysql.

dbConfig.php:

<?

$dbhost="HOST"; // Host name 
$dbusername="USER"; // Mysql username 
$dbuserpass="PASS"; // Mysql password 
$dbname="NAME"; // Database name 

?>

Excerpt from including php file (e.g. login.php):

include_once ("../include/dbConfig.php");
$db_handle = mysql_connect($dbhost, $dbusername, $dbuserpass) or die(mysql_error());

This works fine in his hosted server solution on PHP 5.1. My local setup is Apache & PHP 5.5 on Windows 7.

To use the shorthand <? for starting php comment blocks, you need to enable the directive short_open_tag in php.ini.

The default has changed for new installations since 5.3, see: <? ?> tags not working in php 5.3.1

It is recommended not to use them and change older code to use the full <?php syntax rather than enabling this tag - PEAR coding standards for tags. There are also some rumors that they would be deprecated for PHP 6, but these seem unfounded as I was unable to find any official source.