Jump to content

Commands, but no output?


redcrusher

Recommended Posts

When i get onto a new server, i put a php file on it and see what versions of php sqlite and mysql there are.

 

For some reason, when i put it on this server, it does not show anything ...

 

2 of the lines:

 

echo sqlite_libversion();
echo phpversion();

 

Other php commands work and i am able to call simple methods and what not.  But for some reason those commands and a sqlite query is not working .

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/248074-commands-but-no-output/
Share on other sites

ok so,

 

IF i use:

echo phpinfo();
echo phpversion();

It works.

 

But if i use:

echo sqlite_libversion();

if does not work and nothing under it works either.

 

On that path,

 

$db = "database/mtg.db3"; 

// open database file 
$handle = sqlite_open($db) or die("Could not open database"); 

// generate query string 
$query = "SELECT * FROM cards"; 

// 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); 

 

This does not output anything.

[~]$ yum list | grep -i sqlite
python-sqlite.i386                       1.1.7-1.2.1                   installed
sqlite.i386                              3.3.6-5                       installed
mono-data-sqlite.i386                    1.2.4-2.el5.centos            extras   
pdns-backend-sqlite.i386                 2.9.21-4.el5.centos           extras   
qt4-sqlite.i386                          4.2.1-1                       base     
sqlite-devel.i386                        3.3.6-5                       base     

That just shows the you have sqlite installed on the server.

Is it configured in PHP?

 

If you turn on error reporting in your script

error_reporting(E_ALL);

You will most likely see an undefined function error.

 

Check your PHP config file to see if the sqlite extension is enabled.

error_reporting(E_ALL);	
echo sqlite_libversion();
        ect...

 

This works just like before. nothing shows up ...

 

as for sqlite ... if i do phpinfo() i get:

 

 

pdo_sqlite

 

PDO Driver for SQLite 3.x enabled

PECL Module version 1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6 2006/01/01 12:50:12 sniper Exp $

SQLite Library 3.3.6

 

when errors are displaying:

 

Fatal error: Call to undefined function sqlite_libversion() in /var/www/vhosts/mtgproxydeckbuilder.com/subdomains/alpha/httpdocs/test.php on line 8
[/doce]

and

[code]
Fatal error: Class 'SQLite3' not found in /var/www/vhosts/mtgproxydeckbuilder.com/subdomains/alpha/httpdocs/test.php on line 10

Ok you've now identified the problem - sqlite IS installed in your system, but not installed in php.

 

I don't know enough about your OS to help further, but there appear to be related comments here - http://php.net/manual/en/sqlite.installation.php

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.