Banshee
the secure PHP framework

Forum

error on public/index.php load

colin
30 october 2011, 16:13
Banshee version: 3.3
PHP version: 5.3.6
MySQL version: 5.1.58
sqlite: 3.7.7
Webserver: hiawatha 7.7.1

Caught exception 'SQLite3::__construct() expects parameter 2 to be long, string given'

from my index.php:
/* Load core modules
*/
$_database = new SQLite3_connection(DB_HOSTNAME, DB_DATABASE, DB_USERNAME, DB_PASSWORD);
did i do that wrong?
colin
30 october 2011, 16:38
also, the following warning is shown when running setup_databse:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/randomnumberdir/sqlite.so' - /usr/lib/php5/randomnumberdir/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0

sqlite.so does not exist there. sqlite3.so does. i don't know why php is trying to find it there. I assumed it was a depreciated form of sqlite3.so but that's just a guess.
colin
31 october 2011, 05:01
update: banshee loads fine with mysqli_connection in index.php. I'm sure i'm missing something fundamental about either banshee or the two db's.
Hugo Leisink
31 october 2011, 18:00
What you did wrong in the first place: SQLite works via files, so DB_HOSTNAME and DB_DATABASE are not the right parameters for SQLite3_connection(). Use the script 'show_library_api' to see how that object should be created:
./show_library_api sqlite3_connection

My advice is to first learn more about SQLite3 and how it works.

About the errors: are the right PHP modules installed and loaded?
colin
1 november 2011, 10:55
Ok thanks. i saw the script after i posted. But i already started using mysqli on this install just to try to see how banshee works. Got the error and warning fixed. php.ini had lines with no value. removed sqlite.ini from config.d. i don't think that needs to load as sqlite3 is loading.
yes i'll take a look at sqlite doc before attempting again.
colin
3 november 2011, 15:55
i'm trying to setup new banshee instance with sqlite3. I'm still not sure how to create the object. does $_database = new sqlite3_connection($filename, $mode = null, $encryption_key = null); create the database? Or would it if i had the parameters correct? How is that line in index.php supposed to be? Do i have to change anything else. I've read the other info here on this site regarding sqlite. obviously public/ajax.php has been depreciated. I can create sqlite3 example.db in cli but i don't know how to tell banshee to do the same.
thanks in advance
colin
3 november 2011, 15:56
this is what i get in browser as of now.
Caught exception 'Unable to expand filepath'
colin
3 november 2011, 18:15
current error: Fatal error: Call to undefined function sqlite_open() in /var/www/fortresslinux.org/banshee/libraries/database/sqlite_connection.php on line 21
current index.php: $_database = new sqlite_connection("supersecret.db", 0666);
Hugo Leisink
3 november 2011, 21:23
the sqlite3_connection does not create a database. In only connects to it. Banshee has been created for MySQL. The database dump (mysql.sql) is a MySQL dump. If you want to use SQLite, you have to port the create and insert SQL commands in that dump file to SQLite manually.

Yes, public/ajax.php has been integrated in public/index.php a long time ago. But what does that have to do with SQLite?

I have no idea what the 'Unable to expand filepath' means. Is it a SQLite error? Is the path to your sqlite db file correct?

The sqlite_open() error message indicates that you haven't installed SQLite support for PHP or you haven't configured it properly yet.
colin
4 november 2011, 03:12
thank you. sorry for the barrage! ajax.php reference was regarding your posted response to someone else about other db's in this forum. just wanted to confirm my suspicion and make sure it wasn't relevant in any way. unable to expand filepath was due to my bad file path syntax in my index.php About the sqlite_open: I thought maybe if i had the parameters wrong for sqlite_open() i might get the "undefined function" error. Thanks for clearing that up.
Message preview

The following BB-codes are available in a message:

  • [b]Bold text[/b]
  • [center]Center text or imagen[/center]
  • [color=color name or #RGB code]Colored text[/color]
  • [i]Italic text[/i]
  • [img]Link to image[/img]
  • [right]Align text or image right[/right]
  • [s]Strike-through text[/s]
  • [size=pixelsize]Big or small text[/size]
  • [u]Underlined text[/u]
  • [url]Link to website[/url]
  • [url=link to website]Link text[/url]