www.webdeveloper.com
Results 1 to 8 of 8

Thread: Getting an error in PHP

  1. #1
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,517

    Getting an error in PHP

    using the PHP command sqlite_open() is producing the error Fatal error: Call to undefined function sqlite_open() in H:\Program Files\Abyss Web Server\htdocs\install.php on line 46

    Before anyone jumps in and says that the install path should be C:\ note that when windows was installing it chose H:\ as the install path. So far I have had no problems with using PHP on this install, this error is a first.

    Any ideas?
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  2. #2
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    You don't have the PHP sql-lite extension installed? look at <?php phpinfo(); ?> and it will say nothing about sql-lite if i'm correct. This is odd, because iirc this is compiled in by default so something must have turned it off assuming you're using 5.3+


    Edit: I'll be honest. Using windows doesn't help the situation much. I'm not even sure if you did compile it, or if you downloaded it already compiled... Perhaps you can find a better PHP binary instead of whichever one came with XAMP. If I were you (and I did use Microsoft once upon a time) I would get Virtual Box and make the real freaking web-server, and not a junky hack. Something like nginix or apache httpd. Then use ssh+ftp to work on your site and NAT/PAT to tunnel your visitors to your site. While you're at it you may as well put the SVN/GIT repository on that server. Pick an OS that's easy to use, like ubuntu-server. This assumes you have the memory and processor to handle VM instructions.

    I'm not trying to pick on Abyss httpd, but having a fly-by-night web server doesn't do anything except delay development. Pick the server which has gone through the most strenuous testing: apache.

    Alternatively if you were already using linux, you could symbolically link against the PHP binary that the administrator has already installed using your httpd.conf (apache) and i'd bet he has the sqlite extension working by default.

    Edit 2:
    If you want to continue using windows. I guess you should check out pecl.php.net and look for the sql-lite extension. Pay some attention to which version of sqlite you have installed on your machine and which version the extension supports (because the extension is making PHP recognize sqlite... the extension needs to work with both the PHP version and the sqlite version you have).
    Last edited by eval(BadCode); 07-28-2013 at 05:47 PM.

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,517
    Well I do have the SQLite support, the problem is a simpler problem...

    SQLite2 has been dropped altogether which is not very helpful to the millions of people already using it and they have no backwards comparability with the new SQLite3

    So anyone running a SQLite2 database needs to create and update all their scripting to SQLite3.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  4. #4
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    Some frameworks make you write your sql queries using their php library, and allegedly it makes switching the database version/flavor a really simple thing. I haven't used it myself, but iirc it is from ZFW. Something like:

    new Query(?)->select("foo, bar, bar").from("tableName").where("1");

    I don't do this, because it gets in the way.

    grow a pair, upgrade to sqlite3 and "ack -rni sqlite * ", and read each query to make sure it makes sense, finally, enjoy the new features which will also be backwards incompatible in future version: you will like it Sam

    You could also just install the sqlite2 extension from pecl or pear? Perhaps it's not supported anymore or "non-standard" (oh my gosh), but if its you're jam then do it.
    Last edited by eval(BadCode); 07-30-2013 at 04:04 AM.

  5. #5
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,517
    Its not a question of growing any, its simply that SQLite 2 is not compatible with SQLite 3 nor supported by SQLite3 libraries and has no conversion option built in which is myopic as development goes.

    From looking at the problem, versions of PHP 5.4 upwards do not have SQLite2 bundled so anyone who is on a web host and the web host upgrades to PHP 5.4 will find any SQLite 2 databases useless and no way of converting them.

    As for using SQLite 3, it is a very convoluted way of doing the job and the developers have broken that age old golden rule of "if it aint broke, don't fix it" and I can only add to that statement that if you have to break it, give people a lifeboat to jump on.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  6. #6
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    Well I thank the noodly appendage that I've never used SQLite2 or 3.

    Out of curiosity though, why can't you just use serialize() and unserialize() yourself. SQLite is a SINGLE USER database isn't it?

    If it is a single user database, you could simply write the data ($variable) to some persistent storage, "hard drive", and recall it in an identical data structure you started with at the start of your sqlite2 DML dance? It would save you a bunch of trouble and remedy your SQL errors.

    note: use file write locks when you write it.
    note again: if using linux, consider leveraging the tree structure of the file system (files/directories) and symbolic links to mimic the FKs in a relational database.

    edit:
    its this easy anon,


    PHP Code:

    $x 
    = array('foo','bar','baz',new ArrayObject(array('mustard')));

    // this is like insert into
    file_put_contents("example"serialize($x));

    // this is like select from
    $y unserialize(file_get_contents("example"));

    var_dump($y); 
    All I can see sqlite3 winning at is aggregating data... everything else appears to be an additional hassle to me: which involves lots of query pecking and iterating to undo said joins.
    Last edited by eval(BadCode); 07-30-2013 at 06:59 PM.

  7. #7
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    Wait... let me get this strait... you're just wanting your PHP to have SQLite2 instead of SQLite3.

    That way, if you write

    <?php sqlite_open(); ?> is means use sqlite2, rather than 3.

    Is that what you're wanting help with?
    Last edited by eval(BadCode); 07-30-2013 at 06:55 PM.

  8. #8
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    read here what this person said:
    http://www.php.net/manual/en/ref.sqlite.php#66994

    If that doesn't help, try this (for your web server?):
    http://www.aprelium.com/abyssws/php5win.html

    if that doesn't help:
    http://www.catb.org/esr/faqs/smart-questions.html
    Last edited by eval(BadCode); 07-30-2013 at 07:25 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles