Page 1 of 1

PHP and MySQL

Posted: July 3rd, 2005, 12:18 am
by Scorpo
Can anyone tell me how to get PHP to work with MySQL so that I can set up phpbb ??

Posted: July 3rd, 2005, 3:59 am
by Smartweb
It would help to know what operating system you are running.

Posted: July 3rd, 2005, 12:22 pm
by Scorpo
I'm running Micorsoft Windows XP Proffesional. PHP5 and apache2.

Posted: July 3rd, 2005, 2:40 pm
by Smartweb
If PHP and Apache are working (you can test this by making a php file with <? phpinfo(); ?>), enable the mysql extension in the php.ini file. In php5, mysql is not installed by default, so you have to use the extension. Change the line ";extension=php_mysql.dll" to "extension=php_mysql.dll". Then mysql should work, though that doesn't set up phpbb yet.

Posted: July 3rd, 2005, 7:04 pm
by Scorpo
Well, now I'm getting the following error message: PHP Startup: Unable to load dynamic library 'C:\Server\PHP\php_mysql.dll' - The specified module could not be found. I checked the location and it is in the correct spot at the exact location that is listed above. Is that file corrupted?

Posted: July 4th, 2005, 4:45 pm
by Scorpo
Sorry for doubleposting, but I figured this would be more clear as it is an update.

Posted: July 4th, 2005, 4:46 pm
by Scorpo
Sorry for doubleposting, but I figured this would be more clear as it is an update. The error message described in my last posting has now dissapeared thanks to some help changing some configuration files that my friend found. Unfortunately, I still can't connect to the database using php. Using the following code:

Code: Select all

[i]
[/i]<?php
// *****************************
// ** database server section **
// *****************************
$sqlserver = "localhost";
$sqluserid = "scorpo";
$sqlpassword = "bultiger";
$sqldatabase = "database";
if( !@mysql_connect($sqlserver, $sqluserid, $sqlpassword) ) {
echo("Unable to connect to the database at this time.<br><br>");
exit();
}
if( !@mysql_select_db($sqldatabase) ) {
echo("Unable to locate the database at this time.<br><br>");
exit();
}
$sql = "SHOW TABLES from $sqldatabase";
$resultset = @mysql_query($sql);
if( !$resultset ) {
echo("Unable to run a query at this time.<br><br>");
exit();
}
$row = mysql_fetch_array($resultset);
echo("Looks good! Success!");
?>
I get the message: Unable to connect to the database at this time. Any ideas? Please?

Posted: July 4th, 2005, 8:02 pm
by Smartweb
PHP's error message from the connect attempt would be more useful than yours, which only tells which line fails. Make sure php is configured to give error details, comment out the if (!@mysql_connect ... exit(); }, and add mysql_connect($sqlserver, $sqluserid, $sqlpassword). Then post the error message you get. Or perhaps get rid of the @ sign.