p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP Databases (http://p2p.wrox.com/forumdisplay.php?f=97)
-   -   mysql & php connection problem. (http://p2p.wrox.com/showthread.php?t=54393)

Manu Sharma February 21st, 2007 05:48 PM

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.

rretzko March 1st, 2007 04:38 PM

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.



Manu Sharma March 2nd, 2007 07:03 AM

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

All times are GMT -4. The time now is 11:16 AM.

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