Solved

sqlite on php

Posted on 2014-01-09
4
320 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 34

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

830 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