Solved

sqlite on php

Posted on 2014-01-09
4
317 Views
Last Modified: 2014-01-14
what do I need to install in order to have sqlite on php

how can I import a .sql dump file for create and insert

and how do I run this file?
Am I required to have a sqlite query editor installed and do I need to select an open port?
0
Comment
Question by:rgb192
4 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 166 total points
ID: 39769362
SQLite is either built-in (PHP5.0 to 5.3) or installed from PECL (PHP5.4+).  The SQLite server is the extension that is part of PHP.  I don't know of a 'query editor' for it though there might be.  For a demo, I created the database and tables thru PHP.  No port is needed because the database is accessed thru files and not thru the network.

PHP - http://us2.php.net/manual/en/book.sqlite.php
SQLite - http://sqlite.org/
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 167 total points
ID: 39769685
Please see the answer here:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28331641.html#a39761872

What have you tried in the way of imports?  There may be minor implementation differences, but SQL is SQL and most of the commands should work.
0
 
LVL 33

Accepted Solution

by:
Slick812 earned 167 total points
ID: 39771669
greetings rgb192, do you definitely know that SQLite is NOT available to you in your PHP version? ? Almost ALL PHP installs have SQLite of one version or the other.  Please understand that SQLite is a very different "Data Base Engine" than the MySQL that you are used to. In SQLite you do not connect to a database server, it just "Reads a File" in your directoies to open the Database.

Run this code to see if you have SQLite available -
<?php
error_reporting(E_ALL); 
ini_set("display_errors",1);

if ($dbo = new SQLite3('studys.slite')) {
   echo 'YES, SQLite3 works ! !';
   } else echo 'ERROR, Did NOT open studys.slite file to create Database';
?>

Open in new window

if you do not have SQLite3 then you will see a PHP Fatal ERROR, You may have SQLite2 installed insted? Other code is need for that.

Also, related to your previous question about PDO, , the PDO SQLite is NOT the same as the PHP SQLite, as far as installation. I have used servers where PDO had SQLite3, but the PHP only had SQLite2 installed, you can have   PDO  with SQLite, and PHP without SQLite, or the other way.
0
 

Author Closing Comment

by:rgb192
ID: 39780909
From another question, I now know it is just a php.ini change. Best answer for me is the php to test availability of sqlite.

Thanks all.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question