Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

sqlite on php

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
rgb192
Asked:
rgb192
3 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
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
 
Ray PaseurCommented:
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
 
Slick812Commented:
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
 
rgb192Author Commented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now