Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unable to access MySQL through PHP and phpMyAdmin on Win 7 PRO ....

Posted on 2010-11-28
10
Medium Priority
?
456 Views
Last Modified: 2012-05-10
Hello:
I am having problems with accessing MySQL from PHP and phpmyadmin. I guess the problem may have the same root. Here is the problem description:

phpmyadmin

When I type in http://localhost/phpmyadmin/index.php, the login page is displayed. After entring userid and password, the page hangs for a while than browser (IE8) dispalys the following message:

The website cannot display the page
 HTTP 500  
   Most likely causes:
•The website is under maintenance.
•The website has a programming error.
 
   What you can try:
     Refresh the page.
 
     Go back to the previous page.
 
PHP

The page hangs for a while than displays the page with a javascript error. The page works great withoout the MySQL Access code.

I am able to access MYSQL from other softwares like" PHP Generator For MYSQL" and RazorSQL

Thanks,

<<< Ali >>>
0
Comment
Question by:MohammadAliQureshi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 
LVL 27

Expert Comment

by:Tolomir
ID: 34226818
0
 

Author Comment

by:MohammadAliQureshi
ID: 34226861

Hello Tolomir:

Attached is the PHP code I am using ...

Thanks,
<<< Ali >>>
<?php
echo "Trying To Connect ...";
$con = mysql_connect("localhost:3306","uid","pwd");

 if (!$con)
  {
    die('Could not connect: ' . mysql_error());
  }
echo "connected ...";
    $dbselect = mysql_select_db("test", $con);

 if (!$dbselect)
  {
    die('Unable To Select Database: ' . mysql_error());
  }
 echo "dbSelected ...");
$result = mysql_query("SELECT ....WHERE (DayOfYear(curdate()) - 1) between start_dayofyear AND end_dayofyear;", $con);

if (!$result)
 {
  $error = 9;
  die ("Unable To Retrieve Prayer Timings: ".mysql_error());
  }
 if (mysql_num_rows($result) > 0)
  {
 $row = mysql_fetch_array($result);
 }
else
{
  $error = 9;
  die ("Unable To Retrieve ..: \n"." ".mysql_error());
  }
?>

Open in new window

0
 
LVL 6

Expert Comment

by:kiwistag
ID: 34226955
Check the security permissions. It could be something in the background it's trying to access that is blocked/denied.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MohammadAliQureshi
ID: 34227078
Hello kiwistag:

Just wondering .... If there was a security issue, I think, I  should not be able to access MYSQLfrom other softwares?

Thanks,
<<< Ali >>>
0
 
LVL 6

Expert Comment

by:kiwistag
ID: 34227297
Are you using IIS or apache?
0
 

Author Comment

by:MohammadAliQureshi
ID: 34227340
Hello kiwistag:

Apache ...
0
 

Author Comment

by:MohammadAliQureshi
ID: 34231794
Hello:

I have new issues regarding this problem ...

I uninstalled MySQL Server so that I can reinstall it uner C:\ where PHP, Apache are also installed.
Now, MySQL is not starting as Windows Service ... giver error 1067 (At times the error message is unable to find path ... I did change the slashes to match Windows on my.ini file .. but no success).

I did look around this site for the solution to 1067 problem, but none of the solution worked for me.

Tonight, I will reinstall MYSQL as Windows service with a different name (i.e.. MySQL2 instead of MySQL) and see if this helps ... I thought I will update you with the current happenings.

Thanks,

<<< Ali >>>
0
 
LVL 6

Expert Comment

by:kiwistag
ID: 34235713
Check that the existing service is pointing in the same location. I'm not too familiar with error 1067 but try points here: 2.10.5. Troubleshooting a MySQL Installation Under Windows

Is it possible that PHPmyAdmin needs to write to a config file somewhere and the security settings deny initial anonymous writes? I haven't used it enough to be sure.
0
 

Accepted Solution

by:
MohammadAliQureshi earned 0 total points
ID: 34235915
Hello:

UPDATE

I change the log file to C:\PHP\log and found the following error:

Warning: mysql_connect() [function.mysql-connect]: [2002]
A connection attempt failed because the connected party did
not (trying to connect via tcp://localhost:3306) in
C:\Path\To\Script.php on line 26

Warning: mysql_connect() [function.mysql-connect]: A connection
attempt failed because the connected party did not properly
respond after a period of time, or established connection failed
because connected host has failed to respond. in
C:\Path\To\Script.php on line 26

Fatal error: Maximum execution time of 30 seconds exceeded in
C:\Path\To\Script.php on line 26

Than I google the error and found the fix on this site:

http://ryan.rawswift.com/2010/03/29/a-connection-attempt-failed-because-the-connected-party-did-not-properly-respond/

The fix is simple as follows:
1.Go to “C:\Windows\System32\drivers\etc“.
2.Open “hosts” with Notepad program.
3.Uncomment this line: “127.0.0.1 localhost” or add it if it’s not on the host entry.

I will keep this question for couple of days in case I need some help ...

Anyway ... Thanks for all the help and the time all of you have invested ....

Thanks,
<<< Ali >>>
0
 

Author Closing Comment

by:MohammadAliQureshi
ID: 34426523
I found the solution on the net ....
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question