I have a fresh install of fedora 12 and am trying to get php and sqlite working I installed php through: yum install php php-devel php-pdo
and restarted apache. Php pages are working just fine but whenever I try to load a page that uses sqlite the page is not processed and returns blank with non of the php code being processed. The page that i am using to test sqlite is:
<html>
<head></head>
<body>
<?php
// set path of database file
$db = $_SERVER['DOCUMENT_ROOT']."/../library.db";
// open database file
$handle = sqlite_open($db) or die("Could not open database");
// generate query string
$query = "SELECT * FROM books";
// execute query
$result = sqlite_query($handle, $query) or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle)));
// if rows exist
if (sqlite_num_rows($result) > 0) {
// get each row as an array
// print values
echo "<table cellpadding=10 border=1>";
while($row = sqlite_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row[0]."</td>";
echo "<td>".$row[1]."</td>";
echo "<td>".$row[2]."</td>";
echo "</tr>";
}
echo "</table>";
}
// all done
// close database file
sqlite_close($handle);
?>
</body>
</html>
The body and html tags are returned but non of the php is rendered. My question is how does one set up php with sqlite. Does one have to recompile, is their an rpm? I am looking for a step by step way of enabling sqlite for php. Thanks
See the answers to this same question that you asked earlier today.
One user mentioned just needing to install the latest version of php-pdo (
yum install php-pdo
) to enable support. That should probably be a good place to start for most users but it looks like you have already done that.It could be because of the SQLite functions I was using in PHP, but that did not work for me on Fedora 13, so my experience involved recompiling PHP from source with sqlite support (to my knowledge it was not built into Fedora Core 4 and later versions). I had to download the source for PHP from http://php.net/downloads.php and compile it with support for the SQLite module.