Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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 April 13th, 2004, 11:03 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH 3 pg 96 Question

Hi, I'm trying to set up my MySQL in the program on this page. I'm putting in the exact information with my password that I set up in the MySQL setup. When I test the file in my browser, I get a:

FATAL ERROR: Call to underfined function mysql_connect() in ...

This is what I have in my code:

$connect = mysql_connect("localhost", "root", "mypassword") or
die ("Hey loser, check your server connection!");


Can you please help me!!!

 
Old April 13th, 2004, 07:44 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Are you using PHP 5? You are getting this error because mysql support is not built into PHP5.. you have to enable the mysql extension. On Windows you'd open up the php.ini file located at C:\Windows\php.ini and uncomment the extension reference (remove the semi-colon), verify the path to the extensions directory:

extension_dir = "C:\PHP\ext"

Save changes.

Make sure that you've downloaded the zip package that contains the mysql .dll (this will be in the ext directory).

Restart Apache, retry the script.

hth,
: )
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 16th, 2004, 10:29 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using PHP 5. I have made the changes that you said to make above, but now i have another problem. When I try to restart my Apache server it says that it can't find the "C:\php\ext\php_mysql.dll" file. I know that I've put the correct extensions and stuff.

What else do i need to do to get this to work? Please help me!

 
Old April 16th, 2004, 02:25 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I think I can recall having the same (or similar) problem with my attempt at using PHP5. I know the proceedures for installing the extension to be complete, as this is the same proceedure for installing any other PHP extension. So I'm not really sure at this point, as I haven't explored PHP5 much. You might want to stick with a PHP4 release till PHP5 comes out of beta testing (mysql support is built into PHP4).

You might ask on a PHP mailing list:
http://www.php.net/mailing-lists.php.

I'd be interested in hearing the solution too.

Regards,
Richard York


::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old August 1st, 2004, 06:41 AM
Authorized User
 
Join Date: Jul 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mririe
 I am using PHP 5. I have made the changes that you said to make above, but now i have another problem. When I try to restart my Apache server it says that it can't find the "C:\php\ext\php_mysql.dll" file. I know that I've put the correct extensions and stuff.

What else do i need to do to get this to work? Please help me!

You also need to uncomment this line:

;extension=php_msql.dll

... and you need to copy libmysql.dll to the %systemroot% directory. That is "WINNT" on NT based systems. Usually will be "Windows" on 95/98/ME/XP-home(?) .

If not sure go to a command window (cmd on NT, command on 9x/me) and type in "CD %systemroot%" (without the quotes). That will take you to your the sysroot.
 
Old August 22nd, 2004, 06:08 AM
Authorized User
 
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had a similar problem with the code on page 96. The file simply would not connect to the server. After much looking around the internet I tried a tip of typing the following through the command prompt :

c:\mysql\bin>mysqld --console

This seemed to make mysql ready for connections thus allowing the php files to work. Why this is needed I don't know, or if there is a better way around this problem.

Hope that helps somebody !

 
Old August 23rd, 2004, 03:14 AM
Authorized User
 
Join Date: Jul 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by carlitio
 I had a similar problem with the code on page 96. The file simply would not connect to the server. After much looking around the internet I tried a tip of typing the following through the command prompt :

c:\mysql\bin>mysqld --console

This seemed to make mysql ready for connections thus allowing the php files to work. Why this is needed I don't know, or if there is a better way around this problem.
In other words you started the daemon aka service. What you did there was start to start the service so it could receive connections, write errors to the console, and keep the console open.

you might also try NET START MYSQL or go to the services MMC console and start or stop it.

Possibly you made a change in mysql or you installed it to NOT run as a service or you killed the service for whatever reason.



 
Old August 24th, 2004, 03:57 PM
Authorized User
 
Join Date: Aug 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm trying this out on an actuall free host ( www.5gigs.com) as I blundered the mysql installation. Unfortunatly I was only givin 1 database. From reading the scripts it looks like all i need is 1 database (wiley). Is this true and if so how do I code createmovie and moviedata as 1 file/database?

 
Old August 25th, 2004, 04:17 AM
Authorized User
 
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You do only need one database to complete chapter 3. To write to and query that database you can use as many php files as you want. Also you could create more tables in that database (on a different theme) and use alternate php files to write to and query those.

For the purposes of going through the rest of the book, if you are new to all this, it is probably wise to take the time out to get your AMP setup working locally. As a pointer, some of the main setup woes come from version problems of the three varying. The setup information in the book was written for:

Apache 2.0.49, PHP 4.3.7, MySQL 4.0.15





Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Fatal Error Chap 3, Pg 96-96 joshkosmala BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 January 8th, 2007 01:55 PM
Ch 5 Arrays Pg 134 Sadlowski BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 February 23rd, 2006 01:25 PM
CH 5 pg 160 wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 8 November 12th, 2003 11:23 PM
CH3, pg 96 Hidden Form Fields wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 19 October 28th, 2003 03:18 PM
CH 3 pg 76 wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 October 26th, 2003 08:46 PM





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