php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54274 SQLite class is not available on FreeBSD default installation
Submitted: 2011-03-16 14:16 UTC Modified: 2011-03-17 03:33 UTC
From: enterco at yahoo dot com Assigned:
Status: Not a bug Package: SQLite related
PHP Version: 5.3.5 OS: FreeBSD
Private report: No CVE-ID: None
 [2011-03-16 14:16 UTC] enterco at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/book.sqlite3
---
FreeBSD uses a 'port system' to install third party packages, including PHP. At this time, FreeBSD's port system is installing PHP as a 'main component' (the php binary, and/or apache module, etc) and every extension is installed separately.

PHP 5.3.5 documentation states that 'SQlite class is installed by default', but this does not happen on FreeBSD, probably because ./configure script is run with the following arguments: 
'Configure Command =>  './configure'  '--with-layout=GNU' '--localstatedir=/var' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local' '--with-zlib-dir=/usr' '--program-prefix=' '--with-apxs2=/usr/local/sbin/apxs' '--with-regex=php' '--with-zend-vm=CALL' '--enable-zend-multibyte' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd8.2'

I have not tried a full source install instead of FreeBSD's default ports system, but I assume that '--disable-all' triggers '--without-sqlite3', so sqlite extension is no longer installed 'by default'.

A documentation update would be appreciate, so FreeBSD users will be informed about the reasons why SQLite3 is not available on this operating system by default. 
I expect SQLite3 will be enabled as an extension on FreeBSD by php port maintainters.

Test script:
---------------
<?php
$db_file = "sample.db";
$db = new SQLite3($db_file);
$sql="SELECT a, b FROM table1;";
$result = $db->query($sql);
while($res = $result->fetchArray(SQLITE3_ASSOC)) {
    echo $res['a']." ".$res['b']."\n";
}
?>

Actual result:
--------------
PHP Fatal error:  Class 'SQLite3' not found in /test/sqlite/sqlite-error.php on line 3

Fatal error: Class 'SQLite3' not found in /test/sqlite/sqlite-error.php on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-17 03:33 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-03-17 03:33 UTC] aharvey@php.net
The PHP manual only covers installs from stock PHP source using the
PHP build system. What FreeBSD does is down to the FreeBSD
maintainer(s).
 [2011-03-17 09:03 UTC] carsten_sttgt at gmx dot de
@aharvey

> The PHP manual only covers installs from stock PHP source using the
> PHP build system.

"--disable-all" is not FreeBSD related, it's an option from the normal PHP build system. I think you should reclassify this as a documentation problem. 

For other extensions with are enabled by default you can read something like:
| This extension is enabled by default, although it may be
| disabled by compiling with --without-foo .

But the second part is missing for SQlite.

BTW:
It would be nice if there was a list in the manual with:
- extension which are in core (or enabled by default but can't be disabled, even with disable-all, like pcre)
- extension which enabled by default but can be disabled (e.g. with disable-all, --disable-foo), like SQlite.
 [2011-03-17 11:08 UTC] enterco at yahoo dot com
I don't know what may happen in the following scenario:
- the build system (regardless of it's name) does not have any sqlite libraries and headers usable by the compiler and linker
- php is built from source, using standard ./configure, which 'by default enables sqlite3', as [currently] documented

I assume that in this scenario won't be available _AND_ usable the SQlite3 class

SQlite3 class does not require some sqlite library to run ? 
Is there a sqlite bundle included with PHP ? Which version ?
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 10:03:45 2023 UTC