Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | 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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 21st, 2007, 05:48 PM
Authorized User
 
Join Date: Feb 2007
Location: , , India.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default mysql & php connection problem.

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';

[u]i get the following error message</u>:--

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 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.




Reply With Quote
  #2 (permalink)  
Old March 1st, 2007, 04:38 PM
Registered User
 
Join Date: Mar 2007
Location: Bernardsville, NJ, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rretzko
Default

Hi Manu - I just ran through a similar problem. I solved this by: confirming that PHP is a subdirectory of your Apache Directory, then 1) confirm that libmySQL.dll is in the PHP directory, 2) confirm that php_mysql.dll is in the PHP directory, and 3) that the path to your PHP files are in your windows PATH.

This worked for me and I hope it works for you.

Rick

Rick
Reply With Quote
  #3 (permalink)  
Old March 2nd, 2007, 07:03 AM
Authorized User
 
Join Date: Feb 2007
Location: , , India.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello Rick,

Thanks for d advice , i really appreciate it man. Actually i have already solved the problem. It was occuring due to the inability of the php engine in reading the php.ini file. So all the changes that i made to the php.ini file we not registered in the file opened using the phpinfo() function.

I had earlier just renamed the php-dist file to php.ini and copied it to the Windows folder butthe problem ws that, this php.ini file was a file of the type ini-dist i had to change it to the configuration type ( the one on which a gear appears in the windows directory )
I did this by copying the contents of my php.ini file ( which was of the type php-dist) to another new notepad document and changing its file type to configuration,......


Reply With Quote
Reply


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
MySQL to MSSQL PHP connection aspBegineer83 MySQL 4 December 26th, 2007 12:40 AM
Dreamweaver 2004 & mySQL database connection DanDan Dreamweaver (all versions) 14 December 16th, 2007 08:15 PM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
MySQL & PHP Parse error Stuart BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 March 17th, 2005 03:44 PM
PHP & MySQL d-dubu MySQL 2 January 14th, 2005 01:32 PM



All times are GMT -4. The time now is 12:39 AM.


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