RE: Can't get MySQL extensions to load

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 I figured this one out late last night.  For as many times as I've set up
PHP on IIS I've never seen this or had to go through these.

I noticed on the phpinfo page that the loaded php.ini file was from
C:\Windows.  Confused I did a search of that directory to see why there
would be a file there.  There was not any file there, but from what I had
read that was a default configuration.  Taking that into consideration I was
armed with some new keywords to use in Google.  Sure enough I found a post
recommending to set up the PHPRC in the System Variables.  Immediately after
that and a restart the proper C:\php\php.ini file was loading, and the mysql
dll's loaded up without issue, and Joomla and Roundcube connected without
any issue.

Strange to me.  I've never had to set that up before, but maybe something
changed since I last did it this way.  I've been playing with the FastCGI
from Microsoft.

Thanks for the help though.  Hopefully someone else finds all of this
information useful.

-----Original Message-----
From: James Crow [mailto:james@xxxxxxxxxxxxx] 
Sent: Monday, December 10, 2007 8:08 AM
To: Patrick Farley
Cc: php-windows
Subject: Re:  Can't get MySQL extensions to load

Run phpinfo again and see if the mysql extension shows as loaded. You should
see a section in the output from phpinfo about mysql. If you do not see that
section than the mysql extension is not loaded. 

If the mysql extension shows that it is loading then it may be something
with the mysql server. Try to connect to the mysql server from the windows
command prompt:

mysql -h 127.0.0.1 -u username -ppassword

If you can connect with that string try the same string in php:
<?php
$db_link = mysql_connect('127.0.0.1', 'username', 'password'); if
(!$db_link) {
	// connection failed
	print "MySQL connection failed. Error was: " . mysql_error(); } else
{
	print "Connection successful!";
	mysql_close ($db_link);
}
?>

That code could have a bug in it because it is all from memory and untested,
but you should get the idea.

If the mysql extension is loading but the php connection won't work post the
response (the mysql_error above) that should help determine the problem.

I have never worked with Win 2003, but it could be that the default firewall
is blocking the mysql connection. Maybe try turning it off or creating an
exception for the mysql server (TCP port 3306). 

Thanks,
James



Since you said that you were using the newest PHP On Sun, 2007-12-09 at
00:11 -0500, Patrick Farley wrote:
> Evening.
> 
>  
> 
> I've installed the latest PHP using the zip files (not the installer) 
> to my Windows 2003 machine with IIS.  I have tested the installation 
> with a
> phpinfo() and was successful.  I installed Roundcube and when trying 
> to connect to the site was greeted with an error about being unable to 
> connect to the database.  I rechecked my connection string and all seemed
well.
> Figuring I'd come back to it later, I went to install Joomla and 
> during the install process was told that Joomla is unable to connect to
MySQL.
> 
>  
> 
> I have checked and rechecked my php.ini file (though I may be missing 
> something not obvious)
> 
> PHP in general works.
> 
> My system PATH is configured for C:\php and I have restarted several 
> times
> 
> I've even redownloaded the php zip files and compared the md5 to make 
> sure it was not corrupt.
> 
> MySQL is active and working on localhost for an email server without 
> any issue.
> 
> Have tried both mysql.dll and mysqli.dll
> 
> I have searched Google with out any success.
> 
>  
> 
> Is this something with PHP or my MySQL install?  I'm out of ideas.
> 
>  
> 
> 
> 
> 
> 
> Patrick
> 

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux