PHP and MySQL

Help with operating systems, apps, and software-related issues.
Post Reply
Scorpo
Registered User
Posts: 26
Joined: June 28th, 2005, 2:38 am

PHP and MySQL

Post by Scorpo »

Can anyone tell me how to get PHP to work with MySQL so that I can set up phpbb ??
Smartweb
Registered User
Posts: 622
Joined: January 15th, 2004, 2:11 am
Contact:

Post by Smartweb »

It would help to know what operating system you are running.
Scorpo
Registered User
Posts: 26
Joined: June 28th, 2005, 2:38 am

Post by Scorpo »

I'm running Micorsoft Windows XP Proffesional. PHP5 and apache2.
Smartweb
Registered User
Posts: 622
Joined: January 15th, 2004, 2:11 am
Contact:

Post 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.
Scorpo
Registered User
Posts: 26
Joined: June 28th, 2005, 2:38 am

Post 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?
Scorpo
Registered User
Posts: 26
Joined: June 28th, 2005, 2:38 am

Post by Scorpo »

Sorry for doubleposting, but I figured this would be more clear as it is an update.
Last edited by Scorpo on July 4th, 2005, 4:48 pm, edited 1 time in total.
Scorpo
Registered User
Posts: 26
Joined: June 28th, 2005, 2:38 am

Post 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?
Smartweb
Registered User
Posts: 622
Joined: January 15th, 2004, 2:11 am
Contact:

Post 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.
Post Reply