[Need Help - PHP/MySQL] - Not connecting to DB, but no error

  • kingdutka
  • Newbie
  • Newbie
  • kingdutka
  • Posts: 10
  • Loc: USA

Post 3+ Months Ago

So I am just learning PHP today and I have it installed and running on my IIS 7.5 server. I tested with a 'phpinfo();' statement and it is working fine.

Now I am trying to connect to a MySQL database. I am following this guide: www. freewebmasterhelp. com/tutorials/phpmysql/4

The problem seems to be with a 'hang' when my script tries to connect to the DB server. I am using some echo statements to try and pin point the issue and have it down to this one line:

Code: [ Select ]
<p><?php
echo "Start<br>";
//phpinfo();
$username='noSuch';
$password='fake';
$database='NONE';

echo "1: Attempting MySQL Connection<br>";
mysql_connect(localhost,$username,$password) or die("Unable to connect to localhost");
echo "2: Connected<br>";
  1. <p><?php
  2. echo "Start<br>";
  3. //phpinfo();
  4. $username='noSuch';
  5. $password='fake';
  6. $database='NONE';
  7. echo "1: Attempting MySQL Connection<br>";
  8. mysql_connect(localhost,$username,$password) or die("Unable to connect to localhost");
  9. echo "2: Connected<br>";


I browse to my file with my internet browser: http://localhost/Test_1.php

And I see '1: Attempting MySQL Connection', but nothing else. So... It seems to be stuck trying to connect... I triple checked the $username and $password that I entered earlier in the script so I know those are ok. I just don't understand why it won't give me one of the 2 messages:

2: Connected
OR
Unable to connect to localhost

But I don't see either message... How is this possible?


EDIT:

I tried setting my variables to random values that should not possibly work and I still have the exact same issue... It's hanging, not printing any messages at all.

nicolai. is-a-geek .com/Test_1.php


On another note, if I upload my 'Test_1.php' to my managed web host at geekisp .com and run the page, the page takes a minute to load and then DOES print out:

Unable to connect to localhost

I tried changing the 'localhost' in the connection:

Code: [ Select ]
mysql_connect('nicolai. is-a-geek .com:3306',$username,$password) or die("Unable to connect to localhost");


But still no luck...

I know geekisp offers MySQL, but for this particular table, I need it working locally...
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • kingdutka
  • Newbie
  • Newbie
  • kingdutka
  • Posts: 10
  • Loc: USA

Post 3+ Months Ago

Ok well, I followed another guide:

http://maximumpcguides .com/windows-vista/how-to-create-a-windows-vista-iis7-mysql-php-web-server/


And now I am getting:

HTTP Error 500.0 - Internal Server Error
C:\PHP\php-cgi.exe - The FastCGI process exited unexpectedly
  • kingdutka
  • Newbie
  • Newbie
  • kingdutka
  • Posts: 10
  • Loc: USA

Post 3+ Months Ago

I found the issue...

The guide was telling me to rename php.ini-dist to php.ini, make a couple edits, save, and place: C:\Windows

I moved it to: C:\PHP

POOF!! It works! Sooooo.... the issue was a simple config option in PHP, as I suspected all along...

Now I get to teach myself how to export all this info to a web table....

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 156 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.