Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2003, 10:00 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default config.php file (define "DSN" ) confusion

Hi,

I am trying to figure out what information it is that I need to put in this file regarding my 'DSN'.

I have the book 'PHP MySQL Website Programming', and it makes reference to a line that should be changed in my config.php file.

The book states that the following line should be changed:
 define("DSN", "mysql://root:@localhost/wrox");

The code downloaded from Wrox has different information:
 define("DSN", "mysql://admin:l3tm3in@localhost/wrox");

What is am trying to figure out is what each value represents.

I am running Windows 2000 and I have Apache(HTTP Server Version 1.3), PHP(latest version) and MySQL(latest version) installed and operational.

Any help would be greatly appreciated.

Thanks,

Paul



 
Old July 8th, 2003, 11:43 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The above is just a URL, like any other URL you might be familiar with.

The full spec of a URL says that you can specify a username and password in the URL itself for accessing password-protected material. For HTTP, this covers sites where Apache is set up to use basic authentication with .htaccess files.

Simply stated, the format goes:

<protocol>://[<username>:<password>@]<host>[<path>]

The square brackets surround optional items.

Lemme break down this one for you:

define("DSN", "mysql://admin:l3tm3in@localhost/wrox");
<protocol> = mysql
<username> = admin
<password> = l3tm3in
<host> = localhost
<path> = /wrox



Take care,

Nik
http://www.bigaction.org/
 
Old July 8th, 2003, 12:57 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I should've been more explicit: The DSN is a URL-esque identifier, it's not necessarily a URL.

For more info on the formats supported, with examples, read the manual at:
  http://pear.php.net/manual/en/packag....intro-dsn.php


Take care,

Nik
http://www.bigaction.org/
 
Old July 8th, 2003, 07:29 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Thank you for your help.

Paul





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to config db connection in a DSN-less server congfuzi Dreamweaver (all versions) 4 June 27th, 2008 06:45 PM
Can I define a new xsl page inside .XML file flyfish XSLT 0 August 29th, 2005 03:33 PM
Linked Tables using file DSN Axra Access VBA 2 February 16th, 2005 02:05 PM
define location for file input tag bleitner Javascript 6 August 21st, 2004 09:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.