473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

[Lighttpd] How can I access SQLite from PHP?

Hello

I was looking for a lighter web server than Apache, and
installed Lighttpd on CentOS through yum. It works fine, but I now
need to use SQLite from a PHP script. I seem to understand that it can
either be access directly, or through the PDO interface.

Can you confirm that the RPM that I used will only allow me to work
through PDO, and not the SQLite library directly, and which is more
recommended?

=====
PHP Version 5.1.6

System Linux asterisk.acme 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22
08:32:04 EDT 2007 i686

Build Date Sep 20 2007 10:01:50

Configure Command './configure' [...] '--without-sqlite' [...]
'--enable-fastcgi' '--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr'
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr'
=====

Thank you.
Dec 9 '07 #1
9 7059
On Dec 8, 6:54 pm, Gilles Ganault <nos...@nospam.comwrote:
Hello

I was looking for a lighter web server than Apache, and
installed Lighttpd on CentOS through yum. It works fine, but I now
need to use SQLite from a PHP script. I seem to understand that it can
either be access directly, or through the PDO interface.

Can you confirm that the RPM that I used will only allow me to work
through PDO, and not the SQLite library directly, and which is more
recommended?
In Centos sqlite may not have been automatically installed or PHP was
not configured the SQL Lite libraries, do a quick check first to see
if sqlite is installed and then check the sqlite docs and make sure
php.ini has the proper settings to recognize it existing. (I've had to
do similar with setting up MySQL in Centos)
Dec 9 '07 #2
On Sat, 8 Dec 2007 20:19:00 -0800 (PST), la***@portcommodore.com
wrote:
>In Centos sqlite may not have been automatically installed or PHP was
not configured the SQL Lite libraries, do a quick check first to see
if sqlite is installed and then check the sqlite docs and make sure
php.ini has the proper settings to recognize it existing. (I've had to
do similar with setting up MySQL in Centos)
Thanks for the tip. Apparently, it's working. For those interested, I
did the following:

1. Remove Apache
2. Install the Lighttpd package
3. Install the Lighttpd FastCGI package
4. If not already installed, install PHP, including the FastCGI
version (run "php -v", and "php-cgi -v" to check)
5. Install the PDO package, which includes the SQLite module
6. Add this to a PHP page in Lighttp's www directory to check that the
whole thing works:
foreach(PDO::getAvailableDrivers() as $driver)
{
echo $driver.'<br />';
}

=Apparently, there are two ways to access SQLite from PHP: Either
directly, or through PDO. Is that correct? Which is better? Are there
other ways I should know about?

Thank you.
Dec 9 '07 #3
Gilles Ganault wrote:
=Apparently, there are two ways to access SQLite from PHP: Either
directly, or through PDO. Is that correct?
Yes. (assuming that by "directly" you mean "through the SQLite libraries")
Which is better?
Depends on your meaning of "better".

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

MSN:i_*************************@hotmail.com
Jabber:iv*********@jabber.org ; iv*********@kdetalk.net
Dec 9 '07 #4
On Sun, 09 Dec 2007 20:55:52 +0100, Iván Sánchez Ortega
<ivansanchez-alg@rroba-escomposlinux.-.punto.-.orgwrote:
>Yes. (assuming that by "directly" you mean "through the SQLite libraries")
Yup, that's what I meant. Here's what CentOS has installed:

# rpm -qa | grep sqlite
sqlite-3.3.6-2
python-sqlite-1.1.7-1.2.1

# rpm -qa | grep php
php-cli-5.1.6-15.el5
php-common-5.1.6-15.el5
php-pdo-5.1.6-15.el5
>Depends on your meaning of "better".
Which is recommended for production work, has the more traction, is
the more stable, etc. :-)
Dec 9 '07 #5
On Dec 8, 9:54 pm, Gilles Ganault <nos...@nospam.comwrote:
Hello

I was looking for a lighter web server than Apache, and
installed Lighttpd on CentOS through yum. It works fine, but I now
need to use SQLite from a PHP script. I seem to understand that it can
either be access directly, or through the PDO interface.

Can you confirm that the RPM that I used will only allow me to work
through PDO, and not the SQLite library directly, and which is more
recommended?

=====
PHP Version 5.1.6

System Linux asterisk.acme 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22
08:32:04 EDT 2007 i686

Build Date Sep 20 2007 10:01:50

Configure Command './configure' [...] '--without-sqlite' [...]
'--enable-fastcgi' '--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr'
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr'
=====

Thank you.
PDO vs. sqlite functions?

Probably PDO. Overhead of using it is minimal, and it's a consistent
interface in case you decide to use some other backend later.

I'm not saying that you'll be able to just swap out another database
without problems, but when/if you do then you won't have to learn a
set of new functions.

Just my 2 cents,
Allain
Dec 9 '07 #6
On Sun, 9 Dec 2007 13:07:44 -0800 (PST), allain
<al************@gmail.comwrote:
>Probably PDO. Overhead of using it is minimal, and it's a consistent
interface in case you decide to use some other backend later.
Thanks. I probably won't need to switch to another database. I was
just wondering how to work with SQLite from PHP scripts.

Thanks.
Dec 9 '07 #7
On Sun, 9 Dec 2007 13:07:44 -0800 (PST), allain
<al************@gmail.comwrote:
>PDO vs. sqlite functions?
BTW, are the two following versions used when SQLite was compiled into
PHP (which it isn't in the RPM package that I used to install PHP)?

$db = new SQLiteDatabase("db.sqlite");
$db = sqlite_open("db.sqlite");
http://devzone.zend.com/node/view/id/760
Dec 10 '07 #8
On 12ÔÂ9ÈÕ, ÉÏÎç10ʱ54·Ö, Gilles Ganault <nos...@nospam.comwrote:
Hello

I was looking for a lighter web server than Apache, and
installed Lighttpd on CentOS through yum. It works fine, but I now
need to use SQLite from a PHP script. I seem to understand that it can
either be access directly, or through the PDO interface.

Can you confirm that the RPM that I used will only allow me to work
through PDO, and not the SQLite library directly, and which is more
recommended?

=====
PHP Version 5.1.6

System Linux asterisk.acme 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22
08:32:04 EDT 2007 i686

Build Date Sep 20 2007 10:01:50

Configure Command './configure' [...] '--without-sqlite' [...]
'--enable-fastcgi' '--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr'
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr'
=====

Thank you.
On 12ÔÂ9ÈÕ, ÉÏÎç10ʱ54·Ö, Gilles Ganault <nos...@nospam.comwrote:
Hello

I was looking for a lighter web server than Apache, and
installed Lighttpd on CentOS through yum. It works fine, but I now
need to use SQLite from a PHP script. I seem to understand that it can
either be access directly, or through the PDO interface.

Can you confirm that the RPM that I used will only allow me to work
through PDO, and not the SQLite library directly, and which is more
recommended?

=====
PHP Version 5.1.6

System Linux asterisk.acme 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22
08:32:04 EDT 2007 i686

Build Date Sep 20 2007 10:01:50

Configure Command './configure' [...] '--without-sqlite' [...]
'--enable-fastcgi' '--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr'
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr'
=====

Thank you.
On 12ÔÂ9ÈÕ, ÉÏÎç10ʱ54·Ö, Gilles Ganault <nos...@nospam.comwrote:
Hello

I was looking for a lighter web server than Apache, and
installed Lighttpd on CentOS through yum. It works fine, but I now
need to use SQLite from a PHP script. I seem to understand that it can
either be access directly, or through the PDO interface.

Can you confirm that the RPM that I used will only allow me to work
through PDO, and not the SQLite library directly, and which is more
recommended?

=====
PHP Version 5.1.6

System Linux asterisk.acme 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22
08:32:04 EDT 2007 i686

Build Date Sep 20 2007 10:01:50

Configure Command './configure' [...] '--without-sqlite' [...]
'--enable-fastcgi' '--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr'
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr'
=====

Thank you.
learning
Dec 10 '07 #9
Gilles Ganault wrote:
allain wrote:
>Probably PDO. Overhead of using it is minimal, and it's a consistent
interface in case you decide to use some other backend later.

Thanks. I probably won't need to switch to another database.
I'd recommend PDO all the same -- the non-PDO database drivers are already
starting to look quite unmaintained. e.g. the non-PDO driver for SQLite
doesn't support SQLite3, whereas PDO does.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 4 days, 2:57.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
Dec 11 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: venkatbo | last post by:
Hi folks, I'm trying to get lighttpd, fastcgi & python working on a 2.4.21.x i686 linux system. I tried following the steps in: ...
74
by: ljh | last post by:
Why would you choose SQL Express (which requires an installed application to work) over the simplicity of an Access database which has no dependencies?
4
by: topmind | last post by:
I tried to install the sqlite extension to PHP using "php_sqlite.dll", but I get the following error message: PHP Warning: Unknown(): Unable to load dynamic library './php_sqlite.dll' - Access...
10
by: rcnews | last post by:
Hi, First timer here. Where's the best place to educate myself on how to use PHP in conjunction with Microsoft Access--good online tutorials, sites, blogs, etc...? I work at a small online...
0
by: fmcarol | last post by:
In the course of playing with my new Lighttpd server, I ran into a problem with the PHP_SELF, PATH_INFO, and ORIG_PATH_INFO variables - specifically, Lighty doesn't provide them to my PHP...
12
by: John Salerno | last post by:
I've been looking around and reading, and I have a few more questions about SQLite in particular, as it relates to Python. 1. What is the current module to use for sqlite? sqlite3? or is that not...
6
by: Noble | last post by:
I am getting ready to write a shareware app in .Net using C# (actually convert a VB shareware). I currently use a third party dll for the data management. It is called the Tsunami Record Manager. I...
2
by: Gilles Ganault | last post by:
Hello I have Lighttpd, PHP in FastCGI, and MySQL up and running on FreeBSD. Now, I'd like to find a tool to stress things, so I can check what happens when I try different things to improve...
1
by: Gilles Ganault | last post by:
Hello There's not much activity in the Lighttpd forum, so I figured maybe some people here use this web server instead of Apache, and would know the cause of the problem. PHP scripts can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.