Could be a bug: PHP5 + Define + Class
Posted: 13. December 2007 09:49
I try google for solution but can't find it anywhere. Thought this could be a bug, so decide to post this.
My problem is my web script doesnt work using DEFINE when call inside the class. Im using XAMPP Windows 1.6.4 installler. I got the problem after install xampp, copy my script and database to correct directory. Run for first time
This is sample what in my script: config.php
database.php
The error only said : Unknown MySQL server host 'DB_SERVER' (11001)
I uninstall XAMPP Windows 1.6.4, and download XAMPP Lite 1.6.4, and it works just fine. There no way to disable DEFINE in php, but this is just the problem that confused me why DEFINE is not working in my script. It should works on PHP 4 and PHP5, tested when i install all package manually.
I have no time to figure it more what would cause the problem, better let the expert who know about xampp do about it
My problem is my web script doesnt work using DEFINE when call inside the class. Im using XAMPP Windows 1.6.4 installler. I got the problem after install xampp, copy my script and database to correct directory. Run for first time
This is sample what in my script: config.php
- Code: Select all
define("DB_SERVER","localhost");
define("DB_USER","user");
define("DB_PASS","password");
define("DB_NAME","database");
/// script continue... //
database.php
- Code: Select all
include('config.php');
class MySQL {
function MySQL() {
mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME) or die(mysql_error());
}
/// script continue... //
}
The error only said : Unknown MySQL server host 'DB_SERVER' (11001)
I uninstall XAMPP Windows 1.6.4, and download XAMPP Lite 1.6.4, and it works just fine. There no way to disable DEFINE in php, but this is just the problem that confused me why DEFINE is not working in my script. It should works on PHP 4 and PHP5, tested when i install all package manually.
I have no time to figure it more what would cause the problem, better let the expert who know about xampp do about it