Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 22nd, 2007, 11:22 AM
Authorized User
Join Date: Feb 2007
Location: , , India.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting mysql to php??

Hello Everybody,
I'am new to the WAMP (windowsxp + Apache + MySQL + php) based Web site and web applications developement. I have Apache 2.2, MySQL 5 and php 5.2.1 installed on my computer which is running on a xp home edition os.

The php programs which do not reqiure a database connection are easily running on my computer,( i.e the httpd.conf has got the LoadModule php5apache2_2 and phpts.dll is placed in the system32 dir.) . Also the mysql database running on my computer is working fine. But problem arises when i have to connect to the database using php via the function 'mysql_connect'.

I have followed the documentation on the php website regarding 'making php run with mysql' ( i.e i hav uncommented the extensions=php_mysql.dll & have changed the extension dir. path to C:\php\ext, and this is the correct path for my computer also i hav placed libmysql.dll in the system32 directory.)
After doing all the steps when i try to connect to the mysql database using the following code:--

$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
   or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';

i get the following error message:--

Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\test\createmovie.php on line 4

before coming to this forum i have also tried to use the extension php_mysqli.dll ( by uncommenting it in php.ini ) and placing the libmysql.dll in the system 32 directory with the extension dir. path as C:\php\ext but still i got the same error.

I have also tried to place the php folder in the system PATH , following the advice given on the php.net site , but still got the error.I have even tried out the latest versions of the libmysql.dll and php_mysql.dll files from the MySQL website But still it solves nothing.

i have read it in the book Beginning php5 that to make mysql work with php we have to use the libmysqli.dll file instead the libmysql.dll if the mysql version of 4.1 or later are being used , but the zip file i downloaded from the website php.net for php 5.2.1
hasnt got the file libmysqli.dll and on top of that the documentation on the website also advices to use the libmysql.dll file for the php_mysqli.dll extensions.

I'am kinda stuck on this thing , and this problem is preventing me from using php to its full potential.
this error has been givin me a headache ; Please, if anybody has got a solution scrap back on this thread, If u need any more clarification regardin the problem, just scrap in and i'll elaborate on it.
And also on someone's advice i tried using the forward slashes while defining my extensions_dir in the php.ini file. But still no solution.

>>>:(Guys i have tried a lot and looked for the solution in many places, but still no results..:(:(
If someone knows how to solve this problem please help, ...
Thanking You,

Reply With Quote
  #2 (permalink)  
Old February 27th, 2007, 01:18 PM
Authorized User
Join Date: Jul 2006
Location: Happaugh, NY, .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts

Did you include your user and password in the connection script?

Reply With Quote
  #3 (permalink)  
Old February 28th, 2007, 04:29 PM
Authorized User
Join Date: Feb 2007
Location: , , India.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts

yeah sure man, i did include my user name and password in the script

Reply With Quote
  #4 (permalink)  
Old March 5th, 2007, 01:40 AM
Authorized User
Join Date: Mar 2007
Location: , , India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to malay mehta Send a message via Yahoo to malay mehta

Hey Manu Sharma,
your problem seems to be very genuine but i think that instead of phpts.dll file in your PHP file you should have php5ts.dll as when i started programming in PHP with PHP-4; and when i upgraded my PHP with PHP 5.2.1 i have to replace my php4ts.dll with php5ts.dll.....
So it may one of the cause of the problem and also instead using Apache right now use MySQL 5.It can give you better knowledge about Programming with PHP.

Hope that i ideas may help you to solve some of your queries in your mind.
Also using MySQL and MySQLi at the same time might harass you in your work,So better start with MySQL and get habituated with it.Also connection strings for MySQL and MySQLi are different....

Hope My advice may help you,

Nice meeting you on this forum,

You can Email me at:
great_mehta85@yahoo.co.in ;



malay mehta
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 To MySQL from PHP AlisP2P MySQL 1 January 4th, 2006 02:27 AM
connecting to mysql using Php webmoron BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 6 August 24th, 2004 04:30 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

All times are GMT -4. The time now is 08:55 PM.

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