Jump to content
Larry Ullman's Book Forums

Configuration File


Recommended Posts

Thanks Larry for that fast answer.

 

I am working in windows environment.  Apache was installed with WAMP.  So my setting are as follow:

 

Root directory: " c:\wamp\www\ecom1".

 

I set the configuration file like this:

 

define('BASE_URI', 'C:\wamp\www\ecom1');

define('BASE_URL', 'localhost/ecom1/');

define('PDFS_DIR', BASE_URI . 'includes/pdfs');

define('MYSQL', BASE_URI . 'mysql.inc.php');

 

I copied all the downloaded files in the root directory (C:\wamp\www\ecom1) and  moved the pdf directory and the mysql.inc.php file in the includes directory.

 

When I launch the application from the browser with the address : http://localhost/ecom1, I got a blank page.

Link to comment
Share on other sites

  • 2 months later...

Hello Ken,

 

if you follow the book, all your pages are in folder "html" so

perhaps you must do that  for BASE_URL

 

/ecom (mysqli.inc.php ) -> /html ( /includes(config.inc.php, etc…) , pages.php, etc…) 


define('BASE_URI', 'C:\wamp\www\ecom1');
define('BASE_URL', 'localhost/ecom1/'); <-----    http://localhost/ecom1/html/

define('PDFS_DIR', BASE_URI . 'includes/pdfs');
define('MYSQL', BASE_URI . 'mysql.inc.php');


i work on mac with MAMP and it's fine : (

define('BASE_URI', '/Applications/Mamp/htdocs/ecom1/');
define('BASE_URL', 'http://localhost:8888/ecom1/html/');
define('MYSQL', BASE_URI.'/mysql.inc.php'); 

 

cordialy

  • Upvote 1
Link to comment
Share on other sites

  • 2 months later...

Hi Larry 

I want to thankyou about this great book I bought it in amazon I am glad for, it is worth it. Wish you the Best 

I put the file of the EX2 in the html but need help at the configuration file : I am facing some problem this is for testing in localhost than I am going to put in my hosting domain maybe I am gonna need a little bit more help :

 

Problem:

 

Parse error: syntax error, unexpected 'BASE_URL' (T_STRING) in C:\xampp\htdocs\ex2\html\includes\config.inc.php on line 38

 

// Determine location of files and the URL of the site:
define('BASE_URI', 'C:\xampp\htdocs\ex2\html\');
define('BASE_URL', 'http://localhost/ex2/html/');                     -------------"   LINE 38  "
define('MYSQL', BASE_URI . 'mysql.inc.php');

 

 

What should I change here ?

 

// Set the database access information as constants:
DEFINE ('DB_USER', 'root');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'ecommerce2');
 
// Make the connection:
$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
 
// Set the character set:

 

mysqli_set_charset($dbc, 'utf8');
Link to comment
Share on other sites

Thanks for the nice words. I appreciate it. I don't see an obvious parse error on that line. Are you sure this is the right script/code? In any case, this is just a general parse error due to invalid syntax. If your text editor or IDE has syntax highlighting, it should help point out where the problem starts.

Link to comment
Share on other sites

 Share

×
×
  • Create New...