marcel

msg:4161974 | 11:39 am on Jun 30, 2010 (gmt 0) |
Does a simple 'Hello World' work?
<?php Echo "Hello, World!"; ?> Can you connect to the DB manually? Could you show us the connect string you are using?
|
IntegrityWebDev

msg:4162056 | 1:51 pm on Jun 30, 2010 (gmt 0) |
Create a page (info.php) and try this:
<?php phpinfo(); ?>
Should give you some info about your php install and your mysql install.
|
andrewsmd

msg:4162087 | 2:27 pm on Jun 30, 2010 (gmt 0) |
I should have been more specific. I can run PHP, I even ran a script that uses curl. As soon as I put a mysql_connect("blah"...); command in, then the page just loads like it is in a redirect loop.
|
Red_Eye

msg:4162090 | 2:31 pm on Jun 30, 2010 (gmt 0) |
With PHP 5 the MYSQL functions are now an extension and I think that normally you need to uncomment the extensions you want to use in the PHP.ini file.
|
andrewsmd

msg:4162100 | 2:39 pm on Jun 30, 2010 (gmt 0) |
I thought of that, they are uncommented. If they weren't wouldn't I get an error when I call the method?
|
IntegrityWebDev

msg:4162119 | 3:00 pm on Jun 30, 2010 (gmt 0) |
So when you run phpinfo, it tells you all is OK with mysql?
|
Red_Eye

msg:4162122 | 3:01 pm on Jun 30, 2010 (gmt 0) |
Is the error reporting switched on in the php.ini file. That way it might throw an error.
|
andrewsmd

msg:4162140 | 3:17 pm on Jun 30, 2010 (gmt 0) |
So this is all my php info lists for mysql mysqlnd mysqlnd enabled Version mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $ Compression supported Command buffer size 4096 Read buffer size 32768 Read timeout 31536000 Collecting statistics Yes Collecting memory statistics No Also, my curl script is not working now. It was working fine yesterday, and I had not changed the file at all, and now it is saying call to undefined function curl_init(); I see they are enabled in the ini file, but curl does not even show up in the phpinfo anywhere. I will enable error reporting. Should I just uninstall and re-install?
|
andrewsmd

msg:4162141 | 3:19 pm on Jun 30, 2010 (gmt 0) |
This is what my error reporting was set to error_reporting = E_ALL & ~E_DEPRECATED
|
andrewsmd

msg:4162164 | 3:49 pm on Jun 30, 2010 (gmt 0) |
So I just uninstalled and re-installed. Curl is working again, but the mysql is not. After letting the page run for a while with this code mysql_connect("localhost","user","pass"); @mysql_select_db("db") or die( "Unable to select database"); $query="SELECT * FROM contacts"; $result=mysql_query($query); var_dump($result); mysql_close(); I get Unable to select database, however, if I run a mysql client with that exact information it connects fine. Any ideas?
|
andrewsmd

msg:4162216 | 4:49 pm on Jun 30, 2010 (gmt 0) |
Ok, finally figured it out. After just trying a mysql_connect(blah...) or die(mysql_error()); I got that it couldn't connect to the host. I was using localhost. Apparently php couldn't resolve localhost to 127.0.0.1. Put in 127.0.0.1 and it works. I'm sure there's some setting in PHP to fix this, or possibly changing my hosts file. But it's working! Thanks for everyone's help.
|
Anyango

msg:4209259 | 9:28 am on Sep 30, 2010 (gmt 0) |
Its an old topic, and im sure im late to be of any help for andrewsmd but i just came across this post and i know why it happens, so posting just in case anyone else needs to figure out why this happens. In the latest versions of windows which mostly support IPV6 too, localhost doesnt exactly always map to 127.0.0.1 and hence when your script calls mysql_connect to localhost it cant connect. If you go to your HOSTS file you will see an entry like this #127.0.0.1 localhost You have to uncomment it, for it to be able to successfuly resolve localhost to that. It surely does happen on my win7 ultimate Hope this helps anyone who is trying everything to figure out why their code or phpmyadmin cant connnect to mysql on their new windows Cheers
|
|