PDA

View Full Version : MySQL 5 and PHP, connection issue


Dabrowski
3-12-06, 06:56 PM
I can't figure out how to connect properly using MySQL 5. My host upgraded a week ago, but my site had issues just yesterday. Now, when I make a connection, nothing outputs to the browser. I see that there is something about a strict mode in MySQL, and I'm wondering if that could be part of the problem.

Here is a test script that pretty much strips down the problem:

<?php

echo '<p>before connection</p>';


//$please_connect = 1;

if ($please_connect == 1){

mysql_connect ("localhost", "user", "pass") or die(mysql_error());
mysql_select_db ("name");

} else {

echo '<p>you did not ask to connect.</p>';

}

echo '<p>after connection</p>';

?>

If $please_connect is set, then nothing outputs to the browser, not even the text before the connection. And there is no error, so the connection does go through.

If it is commented out, then naturally, it outputs "before connection, you did not ask to connect," and "after connection."

Anyone have any ideas?

extras
3-13-06, 10:46 AM
I'd check with a tool like "mysql".
With -v -v -v (and other) options, it will tell you what's wrong if it fails.
Probably something as simple as wrong DB host name, username, DB name, and so on.

But it can be the problem of PHP5, too, I guess.

Dabrowski
3-13-06, 06:43 PM
I'm not sure what the crux of the problem was, but the host said that PHP and issues talking to MySQL 5 after their update. I'm still waiting for further detail. Hmm.

extras
3-14-06, 08:31 AM
If they say so, then I guess you just have to sit and wait.
Good luck with using PHP and the host.

Dabrowski
3-14-06, 05:17 PM
The fixed it. Said it had something to do with phpsuexec.