PHP doesn't recognize mysql_connect
Posted by: Hoppy (---.hsd1.ca.comcast.net)
Date: October 11, 2007 11:41PM

I just installed Wamp5. Installation was easy as pie.

However, I can't get PHP to recognize mysql functions. When I run a test script, I get:
"Fatal error: Call to undefined function mysql_connect() in C:\wamp\www\myPHP.php on line 23"

I've tried the obvious things. I put libmysql.dll in my Path environment variable. I made sure that php.ini pointed to c:/wamp5/php/ext for its extension_dir. I checked that all of the mysql dll extensions were uncommented in php.ini and I put a copy of libmysql.dll in my c:/WINDOWS directory (even though some people think that' a bad idea).

Nothing I've tried worked.

Please help,

Hoppy



A program is like a nose,
Sometimes it runs and
Sometimes it blows.

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: toivo (203.19.130.---)
Date: October 12, 2007 12:55AM

Hi,

Did you perhaps have MySQL and/or PHP installed in the workstation before you installed WAMP? That could cause some confusion and the simplest thing is to uninstall the previous installations.

The php.ini file which controls the PHP functions under Apache is in c:\wamp\Apache2\bin. There is also another php.ini in c:\wamp\php which controls the PHP command line scripts.

You should be able to run the phpinfo() function. Add the following script to the document root and browse to it:

<?php
phpinfo();
?>

The seventh line of the output will tell you where the loaded configuration file php.ini file is.

Regards,



toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: Hoppy (---.hsd1.ca.comcast.net)
Date: October 12, 2007 03:37PM

Dear toivo,

I took your suggestion and found that PHP thought my php.ini file was in c:/WINDOWS. So I turned off all of the services, copied the php.ini from the Apache2/bin folder to c:/WINDOWS and restarted all of the services (Apache, MySql). I still get the same result.

Any other ideas would be greatly appreciated.

Hoppy



A program is like a nose,
Sometimes it runs and
Sometimes it blows.

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: jw_k (---.net-you.de)
Date: October 12, 2007 08:38PM

>'ve tried the obvious things. I put libmysql.dll in my Path environment variable.
A correct version of libmysql.dll has to be in apache/bin folder.

>I made sure that php.ini pointed to c:/wamp5/php/ext for its extension_dir.
Again, ask phpinfo() for the correct location of the ext folder.

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: jw_k (---.net-you.de)
Date: October 13, 2007 12:36AM


[from PM]>Loaded Configuration File C:\wamp\logs\php_error.log
this is why your php is not working as intended:
since the php.ini was not loaded all values are the "compiled-in" ones!

I never saw such a weird phpinfo output!

>path: [snip];c:\wamp\php\libmysql.dll
this is definitely not a directory! The path is a collection of *folders*, not files.

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: jw_k (---.net-you.de)
Date: October 13, 2007 12:43PM

[from PM]>didn't understand your [form PM]> comment.
your php is borked

>I looked at c:\wamp\logs\php_error.log and it was empty.
shouldn't be loaded in the first place

>Why was php.ini not loaded? How can I fix this?
I don't know either.

I'd clean up everything(deinstall,registry,orphaned php.ini files etc.) and try a wamp5 (or even [xampp.org] ) install from a fresh download
Good luck!



Post Edited (10-14-07 13:21)

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: yfastud (---.se.biz.rr.com)
Date: October 13, 2007 05:16PM

Quote

found that PHP thought my php.ini file was in c:/WINDOWS
It seems you are having or you had another php in your computer, check this my old post for the idea

[forum.wampserver.com]

Have fun,

[test.jlbn.net] (Sample Testing Codes for PHP, MySQL, ASP.net, SQL, JSP)
[www.jlbn.net] (Basic Guide for WAMP & Add-ons)

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: Hoppy (---.hsd1.ca.comcast.net)
Date: October 13, 2007 05:31PM

I uninstalled wamp. I cleaned everything out of the registry that contained "php" (within reason). I reinstalled wamp and IT NOW WORKS.

Danke schön!

Hoppy



A program is like a nose,
Sometimes it runs and
Sometimes it blows.

Options: ReplyQuote
Re: PHP doesn't recognize mysql_connect
Posted by: yfastud (---.cable.mindspring.com)
Date: October 14, 2007 06:48AM

Glad my idea help you out since I know for sure that it must work after you clean up ;-)

Have fun,

[test.jlbn.net] (Sample Testing Codes for PHP, MySQL, ASP.net, SQL, JSP)
[www.jlbn.net] (Basic Guide for WAMP & Add-ons)

Options: ReplyQuote


Sorry, only registered users may post in this forum.