phpversion() and sqlite_libversion() not returning anything I am on a corporate hosting solution, and trying to test for the existence of sqlite. I am running the following code: <?php echo sqlite_libversion(), "\n", phpversion(); ?> But I am getting a blank page. I know PHP is running because phpinfo() is successful, however this is not enough to tell me if sqlite is running as the sqlite.ini is present in phpinfo() but can't find any other information. I am accessing the server via FTP and am locked into the web-root. Does anyone know why phpversion() and sqlite_libversion() are returning nothing? <?php if (function_exists('phpversion')) { echo "La funzione phpversion() e' disponibile nella versione "; echo phpversion(); echo "<br />"; echo "<br />"; } else { echo "La funzione phpversion() non e' disponibile.<br />\n"; } if (function_exists('sqlite_libversion')) { echo "La funzione sqlite_libversion() e' disponibile nella versione "; echo sqlite_libversion(); echo "<br />"; echo "<br />"; } else { echo "La funzione sqlite_libversion() non e' disponibile.<br />\n"; } ?> Answers If the SQLite is not available, the sqlite_libversion() function will not even exist and will just throw a PHP error: Fatal error: Call to undefined function sqlite_libversion() You need to use function_exists() to test if the function is actually there. Additionally, you should configure error reporting so you can actually see error messages. You have several ways to do so: 1. Edit your php.inifile: error_reporting = E_ALL | E_STRICT display_errors = On 2. Put this on top of your script: <?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', TRUE); 3. If PHP runs as Apache module, you can also use an .htaccess file: # Print E_ALL | E_STRICT from a PHP script to get the appropriate number: php_value error_reporting 2147483647 php_flag display_errors on Update: What do you get if you run this code and nothing else? <?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', TRUE); header('Content-Type: text/plain'); var_dump(phpversion()); if( function_exists('sqlite_libversion') ){ var_dump(sqlite_libversion()); } ?> A Unfortunately I am locked into web-root and option 2 is not showing any errors. This is also showing nothing: echo (function_exists ("sqlite_libversion")) ? "sqlite exists":"not here"; B See my update A Cheers I get this: string(15) "5.2.6-1+lenny13" It's not installed, an error on the page was stopping the function_exists() from running. –------------------------------------------------------------------------------take out the echo, just do <?php phpversion(); sqlite_libversion(); ?>
© Copyright 2024 ExpyDoc