Jump to content

Check if PEAR is working on Server?


spyderfusion02

Recommended Posts

Hey, i was using some PEAR script for my site, but the page I load turns out blank. Is there a test script to see if PEAR is actually installed on my web host(ix web hosting).

Here is the script I am using in case you are interested:

 

 

 

<?php

 

include('db_login.php');

require_once('DB.php');

 

$connection = DB::connect("mysql://$db_username:$db_password@$db_host/$db_database");

 

if (DB::isError($connection)){

die("Could not connect to the database: <br />".DB::errorMessage($connection));

}

 

$query = "SELECT * FROM books NATURAL JOIN authors";

$result = $connection->query($query);

 

if (DB::isError($result)){

die("Could not query the database:<br />$query ".DB::errorMessage($result));

}

 

echo('<table border="1">');

echo '<tr><th>Title</th><th>Author</th><th>Pages</th></tr>';

 

while ($result_row = $result->fetchRow()){

echo"<tr><td>";

echo $result_row[1] . '</td><td>';

echo $result_row[4] . '</td><td>';

echo $result_row[2] . '</td></tr>';

}

 

echo("</table>");

$connection->disconnect();

 

?>

 

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/112045-check-if-pear-is-working-on-server/
Share on other sites

Firstly, check your include_path to see if pear is in there.

 

<?php echo get_include_path(); ?>

 

If it shows up in there it is likely installed, attempt to include a class.

 

 

This is what is displayed:

 

.;c:\PHP\pear

 

 

Does this mean it is installed?

hmm you say your page is blank but you have stuff like

 

echo('<table border="1">');
echo '<tr><th>Title</th><th>Author</th><th>Pages</th></tr>';

 

that aren't in any conditions or anything, so you should at least be seeing that.  Do you have error reporting turned on? Stupid question, but your filename is *.php not like *.html right?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.