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 August 13th, 2004, 06:28 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default connecting to mysql using Php

Sorry folks, but I just can't get round this one and need some help. I'm stuck at chapter 3 with the createmovie.php, whenever I use

http://localhost/createmovie.php

I get the following message

Fatal error: Call to undefined function mysql_connect()

Any ideas where in my mysql setup or php setup I must have gone wrong? I've currently reinstalled several times (hitting most of the install problems mentioned on this forum), but can't seem to see this one. I've tried just using the code supplied by wrox on the assumption I've speeled things wrong, but alas no avail.

Thanks in advance

 
Old August 13th, 2004, 10:00 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Could you please post the exact code of tha page is giving you problem.

Christian

 
Old August 13th, 2004, 10:55 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I believe the problem lies in the setup of PHP rather than the code.

Snib

<><
 
Old August 13th, 2004, 03:31 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

It sounds like you're using PHP 5, MySQL functionality is not included in PHP 5 by default, but it is included in PHP 4 by default. So you have a few options, you could go back to PHP 4, which was what the book was written with. Or you could go through the process of installing the mysql extension with PHP 5 (PHP version shouldn't matter as far as the book is concerned).

AFAIK, all you have to do is uncomment the extension .dll in php.ini and make sure that the extension path is correct and the extension exists in that directory.

So step by step, open php.ini typically located at C:\Windows\php.ini.

Provide the correct path to the extension directory.
Code:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"
I recommend C:\PHP\extensions.

Uncomment the extension by removing the semi-colon.
Code:
;extension=php_msql.dll
extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
Save php.ini.

These extra extensions are typically available in the .zip download of PHP but not the Windows installer.

Finally you need to copy libmysql.dll from the PHP directory to the Windows directory, e.g. C:\Windows.

Restart Apache, MySQL ought to work now.


Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old August 16th, 2004, 04:10 AM
Authorized User
 
Join Date: Jul 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by richard.york
 Finally you need to copy libmysql.dll from the PHP directory to the Windows directory, e.g. C:\Windows.
That would work on a NON-NT machine. NT machines are Win2k, WinXP. If you are on Win95/8 or WinME then Windows is probably the place.

On a an NT based box, you can easily check from a commnad line.

C:\> echo %systemroot%

That will give you the exact location

 
Old August 22nd, 2004, 04:39 AM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I had the same problem w/ webmoron... I it copied already the libmysql.dll even libmysqli.dll but the error persists still... and in phpinfo, there is no mysql information..
Thanx

 
Old August 24th, 2004, 04:30 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the replies, apologies for the delay in replying. Have to confess, I finally gave up on getting everything to talk to each other so bailed out and used foxserv.

I think richard hit the problem correctly as I was starting to get some communication when I opened winmysqladmin directly - at this point I forgot my wonderfully crafted password/username and hence used foxserv next installation round... [and you thought my username was a joke!]






Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to mysql withh PHP ramon Beginning PHP 1 October 18th, 2008 03:40 PM
Trouble connecting MySQL to PHP nofences84 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 June 14th, 2007 11:21 PM
Connecting mysql to php?? Manu Sharma BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 March 5th, 2007 01:40 AM
Connecting To MySQL from PHP AlisP2P MySQL 1 January 4th, 2006 02:27 AM
list_db.php - Connecting to a MYSQL server phpnukes BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 March 3rd, 2004 08:31 PM





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