View Single Post
  #1 (permalink)  
Old February 21st, 2007, 05:48 PM
Manu Sharma Manu Sharma is offline
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 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 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