capkova6
Posted by: vdolnik1 (---.hfc.comcastbusiness.net)
Date: July 11, 2009 07:38AM

Hello,
With a line like
$connection = mysql_connect("localhost", "username", "password"winking smiley;
I received a message Fatal error: Call to undefined function mysql_connect(). I understood this meant a lack of communication between PHP and MySQL, a common surprise when going from php4 to php5. I confirmed the diagnosis by running phpinfo() where mysql was not shown.
I tried to fix the problem and
1) made sure extension=php_msql.dll in php.ini was uncommented.
2) made sure the path to the extension directory in php.ini was correct: extension_dir = "c:/wamp/bin/php/php5.2.9-2/ext/"
3) I saved, as recommended by others, the php.ini file in the Windows/system32 directory.
4) As it did not help I also saved files libmysql.dll, libmysqli.dll, php5apache2.dll, php5ts.dll, and phpmysql.dll in windows/system 32.
I am still receiving the message Fatal error: Call to undefined function mysql_connect(). Phpinfo() remains without shown mysql information.
Please advice.
Vlad Dolnik

Options: ReplyQuote
Re: capkova6
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: July 11, 2009 01:11PM

Do not move any files that come with WAMP. There is no need to do this.

What you should of done is left click the WAMP tray icon and select PHP > PHP extensions > php_mysql (do the same for php_mysqli too and any other extension you wish to use).

When editing the php.ini you should go to the wamp tray icon and select PHP > php.ini

WAMP will handle the rest for you. Moving files around can cause more problems.

Options: ReplyQuote
undefined function mysql_connect()
Posted by: vdolnik1 (---.hfc.comcastbusiness.net)
Date: July 11, 2009 09:21PM

Unfortunately, WAMP does not handle the rest for me, the message Fatal error: Call to undefined function mysql_connect() remains.
Well, extension =php_msql.dll and extension =php_msqli.dll in php.ini are uncommented.

The path to the extension directory in php.ini is correct: extension_dir = "c:/wamp/bin/php/php5.2.9-2/ext/".

Perhaps I should mention, Windows Vista is the current system, but am not aware of any specific problem it could cause.

I tried to open phpMyAdmin but got a message it cannot open mysqli extension. I checked repeatedly php.ini for any typo or illogical error but I could not find any.

Of course, the list of extensions under the WAMP tray icon shows both php_mysql and php_mysqli on, but it did not help.

I also tried to open all extensions, just for sure, it did not help so I returned to the previous settings with about only 8 extensions active. I expect the problem to be in php.ini but cannot find anything wrong.

Any idea what else can cause the problem or how to find its cause?

Vlad Dolnik

Options: ReplyQuote
Re: capkova6
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: July 11, 2009 09:47PM

Ok exit wamp and remove the php.ini in Apaches bin directory. Now edit the file named phpForApache.ini in your PHP folder (not the file named php.ini) and unset all loaded extensions. Start WAMP again and enable the extensions one by one from the WAMP tray icon.

The extension for mysql are call php_mysqli.dll and php_mysql.dll

NOTE: The way WAMP handles the php.ini is slightly different. When you select a PHP version it copies a file called phpForApache.ini (from the folder of the current selected PHP version) to Apaches bin directory and renames it php.ini. This is file PHP gets its configuration from.

Options: ReplyQuote
Re: undefined function mysql_connect()
Posted by: zahidansari (---.5.167.122.airtelbroadband.in)
Date: July 11, 2009 10:38PM

hiii...
if you are new to WAMP , just copy the php.ini file from bin/php/ext to windows/php5/ .If the folder php5 in C: does not exists make a new folder and rename it to php5(or the version of PHP you are using) and copy the php.ini file to it ..

Also copy libmysql.dll to windows/system32/(please find libmysql.dll in ur wamp folder),and php_mysql.dll in the same folder(c:/windows/system32/)...

This worked for me and I hope it will work for you also....

NOTEyawning smileylder version of WAMP were not having issue connecting to mysql but due to some licencing problem this issue is arriving in new version of WAMP....


If your problem is solved please reply

Options: ReplyQuote
#1045 - Access denied for user 'root'@'localhost'
Posted by: vdolnik1 (---.hfc.comcastbusiness.net)
Date: July 13, 2009 09:22AM

Thanks to c2dan and zahidansari for their time and effort.
I placed php_mysql.dll and other files in Windows and Windows/system32 but it did not work.
I tried the other procedure too. It did not make a copy of php.ini automatically and I had to manually copy it but the rest of the suggested procedure worked for me.
I made a progress and was able to open phpmyadmin and see the content of my databases made under older versions of mySQL and php. Nevertheless, I could not make any connection from my php document to my database getting responds to my line
$connection = mysql_connect("localhost", "xxx", "yyy"winking smiley;

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'xxx'@'localhost' (using password: YES) in C:\blog\def.htm on line 12

mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\blog\def.htm on line 19

I tried to make it around and changed the user in mysql database through phpmyadmin but now I cannot connect to the mysql database through phpmyadmin, getting the message
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
I changed the user to ‘root’ and removed the password in php.ini but it did not help.
I tried SET PASSWORD FOR root@localhost=PASSWORD('MyNewPassword'); in the MySQL console without success.

So I have 3 questions now:
1) How can I regain the access to the databases? (I can simply reinstall WAMP as a fastest solution but leave it as my last resort.)
2) How can I make my php document to get information from a database without receiving the message mysql_connect() [<a href='function.mysql-connect'>function.mysql-
3) How can I make my php document to get information from database without receiving the message mysql_fetch_array(): supplied argument is not a valid MySQL result resource

I would appreciate your help and advices. Two weeks ago, I was ready to give up and stay with my old php etc. Now I believe I can finish my transfer to PHP5 but will need “a little help from my friends”.
Best regards,

Vlad Dolnik

Options: ReplyQuote
Re: capkova6
Posted by: yfastud (Moderator)
Date: July 13, 2009 02:45PM

download resetmysql here
[downloads.jlbn.net]
to setup password, follow this
[blog.jlbn.net]
to setup db, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: capkova6
Posted by: ianphillips (---.as43234.net)
Date: August 25, 2010 12:09PM

c2dan Wrote:
-------------------------------------------------------
> Ok exit wamp and remove the php.ini in Apaches bin
> directory. Now edit the file named
> phpForApache.ini in your PHP folder (not the file
> named php.ini) and unset all loaded extensions.
> Start WAMP again and enable the extensions one by
> one from the WAMP tray icon.
>
> The extension for mysql are call php_mysqli.dll
> and php_mysql.dll
>
> NOTE: The way WAMP handles the php.ini is slightly
> different. When you select a PHP version it copies
> a file called phpForApache.ini (from the folder of
> the current selected PHP version) to Apaches bin
> directory and renames it php.ini. This is file PHP
> gets its configuration from.


Hi Vlad

Did you resolve this as i am having sam eproblem on my live server.

I don't want to fiddle with any config files as it is running live sites via iis

Options: ReplyQuote
Re: capkova6
Posted by: vdolnik (---.hfc.comcastbusiness.net)
Date: August 26, 2010 08:38AM

Ian, I cannot recall details as the problems occurred one year ago. But yes, it worked for me. However, I do not use IIS and so cannot exclude some minor annoying differences. Vlad

Options: ReplyQuote


Sorry, only registered users may post in this forum.