Log in

View Full Version : Wamp phpmyadmin



keyboard
08-01-2011, 09:26 AM
I recently started running wamp on my computer. I have put all my php files into the www directory and would like to run phpmyadmin however it comes up with this

Welcome to phpMyAdmin

Error
MySQL said:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

Any help would be great.

JShor
08-01-2011, 05:18 PM
Try restarting all of your services. If that doesn't work, try uninstalling and reinstalling WAMP.

keyboard
08-01-2011, 11:53 PM
I've restarted the services and reinstalled WAMP. It still won't work.

keyboard
08-02-2011, 10:33 PM
It just started working again. Don't know why. 1 other question. On WAMP when I connect to the database it comes up with a whole heap of messages, but the page still loads but on my online server the messages don't show up.

JShor
08-03-2011, 02:21 AM
Where do you see the messages? Are they on the web page page that is executing the connection to MySQL?

If you're getting Notices, then you can turn that off by configuring the php.ini key of error_reporting to E_ALL & ~E_NOTICE.

JShor
08-03-2011, 02:21 AM
Oh, and restarting Apache. Don't forget that.

keyboard
08-03-2011, 05:46 AM
Yes they are notices. Could you please explain exactly how to disable them?

keyboard
08-03-2011, 05:50 AM
Do you mean this

; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

That was under php.ini in \bin\apache\Apache2.2.17\bin

Is this the bit you mean?

JShor
08-03-2011, 05:03 PM
No. Everything starting with ';' is a comment in php.ini. Open it in Notepad (or Notepad equivalent), search for error_reporting, and keep searching until you find error_reporting without the semicolon in front of it.

Then change the value of that key to E_ALL & ~E_NOTICE.

keyboard
08-03-2011, 11:11 PM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for. The recommended way of setting values for this
; directive is through the use of the error level constants and bitwise
; operators. The error level constants are below here for convenience as well as
; some common settings and their meanings.
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
; those related to E_NOTICE and E_STRICT, which together cover best practices and
; recommended coding standards in PHP. For performance reasons, this is the
; recommend error reporting setting. Your production server shouldn't be wasting
; resources complaining about best practices and coding standards. That's what
; development servers and development settings are for.
; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This
; means it pretty much reports everything which is exactly what you want during
; development and early testing.
;
; Error Level Constants:
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR - fatal run-time errors
; E_RECOVERABLE_ERROR - almost fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_STRICT - run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
; E_DEPRECATED - warn about code that will not work in future versions
; of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; http://php.net/error-reporting
error_reporting = E_ALL & ~E_NOTICE



I changed the last line to what you said but it's still coming up with notices.

keyboard
08-03-2011, 11:13 PM
Also it's coming up with this

( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Documents and Settings\Owner\Desktop\canberra amatuer productions\www\Canberra Amatuer Productions\member.php on line 88
Call Stack
# Time Memory Function Location
1 0.0082 383600 {main}( ) ..\member.php:0
2 0.0146 393384 mysql_fetch_array ( ) ..\member.php:88


On this page


<?php

mysql_connect("localhost", "****", "****") or die(mysql_error());
mysql_select_db("****") or die(mysql_error());


if(isset($_COOKIE['ID_my_site']))
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{


if ($pass != $info['password'])
{ header("Location: login.php");
}


else
{


}
}
}
else


{
header("Location: login.php");
}



$links = "link2.php";




?>

<?php

mysql_connect("localhost", "****", "****") or die('could not connect to database');
mysql_select_db("****") or die('Could not select database');

if (isset ($_POST['submit']))
{
$comment = nl2br(mysql_escape_string (trim ($_POST['comment'])));

$quantity = $_POST['quantity'];
$item = $_POST['item'];

$cheese = "$username - $comment ";



$sql = mysql_query ("INSERT INTO comments (id,comments) VALUES ('0','".$cheese."')");

echo 'Your comment has been entered successfully!';
echo '<a href="member.php">Please click here</a>';

}

else
{


?>


<html>
<head>
<body style="background-color:lightgreen">
</head>
<body>
<?php include("$links");
echo "Hey ".$username;
?>
<br /><br />
<p><b>COMMENTS</b></p>
<?php
// POST data wasnt entered, so display the comments and comment form
// view comments from database
$sql = mysql_query ("SELECT * FROM comments");
while ($row = mysql_fetch_array ($sql)) {
echo $row['comments'].'<br />';
}



echo '<br /><br />
<form action="member.php" method="post">
Comments:<br />
<textarea name="comment" cols="40" rows="7"></textarea>
<input type="submit" value="Submit" name="submit">
</form>';
}
?>
</body>
</html>

Any help would be great

JShor
08-04-2011, 12:16 AM
There are actually two php.ini files included with WAMP (I never understood why).

I found this out the hard way. There was one in the Apache directory, and there's one in the PHP installation directory. I'm not sure which one is the active one, but try modifying both of them.

keyboard
08-04-2011, 01:40 AM
Yep, changed the second php.ini and the notices stopped but the warning is still coming up and the comments box won't work.

The error is

( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Documents and Settings\Owner\Desktop\canberra amatuer productions\www\Canberra Amatuer Productions\member.php on line 88
Call Stack
# Time Memory Function Location
1 0.0082 383600 {main}( ) ..\member.php:0
2 0.0146 393384 mysql_fetch_array ( ) ..\member.php:88

JShor
08-04-2011, 04:01 AM
In the future, you should be posting these errors under the PHP discussion board to get more attention. Please provide us with the code for member.php so we can diagnose the problem.

keyboard
08-04-2011, 07:46 AM
The code above is member.php

keyboard
08-04-2011, 07:47 AM
<?php

mysql_connect("localhost", "****", "****") or die(mysql_error());
mysql_select_db("****") or die(mysql_error());


if(isset($_COOKIE['ID_my_site']))
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{


if ($pass != $info['password'])
{ header("Location: login.php");
}


else
{


}
}
}
else


{
header("Location: login.php");
}



$links = "link2.php";




?>

<?php

mysql_connect("localhost", "****", "****") or die('could not connect to database');
mysql_select_db("****") or die('Could not select database');

if (isset ($_POST['submit']))
{
$comment = nl2br(mysql_escape_string (trim ($_POST['comment'])));

$quantity = $_POST['quantity'];
$item = $_POST['item'];

$cheese = "$username - $comment ";



$sql = mysql_query ("INSERT INTO comments (id,comments) VALUES ('0','".$cheese."')");

echo 'Your comment has been entered successfully!';
echo '<a href="member.php">Please click here</a>';

}

else
{


?>


<html>
<head>
<body style="background-color:lightgreen">
</head>
<body>
<?php include("$links");
echo "Hey ".$username;
?>
<br /><br />
<p><b>COMMENTS</b></p>
<?php
// POST data wasnt entered, so display the comments and comment form
// view comments from database
$sql = mysql_query ("SELECT * FROM comments");
while ($row = mysql_fetch_array ($sql)) {
echo $row['comments'].'<br />';
}



echo '<br /><br />
<form action="member.php" method="post">
Comments:<br />
<textarea name="comment" cols="40" rows="7"></textarea>
<input type="submit" value="Submit" name="submit">
</form>';
}
?>
</body>
</html>

Any help would be great


That's it again

JShor
08-04-2011, 04:06 PM
Sorry, I overlooked that other post and didn't see the code posted before.

Try changing line 88 to the following:


$sql = mysql_query ("SELECT * FROM comments") or die(mysql_error());;


mysql_error() will tell us if MySQL is not executing the code properly and what error it is giving if $sql's query fails. When you get the error, post it here.

Also, you're reconnecting to MySQL twice in your script. You really only should be connecting once. Connecting multiple times when a connection is already open puts a lot of stress on your DB.