Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 134171 - sqlite3 is not part of the php-5.1.4 installation using "pdo" USE flag
Summary: sqlite3 is not part of the php-5.1.4 installation using "pdo" USE flag
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Low normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 274512
  Show dependency tree
 
Reported: 2006-05-23 21:57 UTC by Shaul Kedem
Modified: 2009-12-16 20:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shaul Kedem 2006-05-23 21:57:23 UTC
Hi,
 when trying to emerge php with USE="pdo" I get the following drivers:
Array ( [0] => sqlite2 [1] => odbc [2] => mysql )

 As an answer to the command: print_r(PDO::getAvailableDrivers());

 According to the php docs "sqlite" (which is sqlite3) should appear in the list by default.

 I think that something is wrong with the ebuild
Comment 1 Shaul Kedem 2006-05-23 21:59:30 UTC
One more remark.. when saying 'USE="pdo"' I didn't mean that's all I used.

Here are my flags:

> emerge -pv dev-lang/php

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] dev-lang/php-5.1.4  -adabas -apache +apache2 -bcmath +berkdb -birdstep +bzip2 -calendar -cdb -cgi -cjk +cli +crypt -ctype +curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob +exif -fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase -ftp +gd -gd-external +gdbm +gmp -hardenedphp -hash -hyperwave-api -iconv -imap -informix -inifile -interbase -iodbc +ipv6 -java-external -kerberos -ldap -libedit -mcve -memlimit +mhash -ming -msql -mssql +mysql -mysqli +ncurses +nls -oci8 -oci8-instant-client +odbc -pcntl +pcre +pdo -pdo-external -pic -posix -postgres -qdbm +readline -recode +reflection -sapdb -sasl +session -sharedext -sharedmem -simplexml -snmp -soap -sockets -solid +spell +spl +sqlite +ssl -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer +truetype -unicode -vm-goto -vm-switch -wddx +xml -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip +zlib 0 kB
Comment 2 G 2006-06-10 14:36:00 UTC
This problem is reproducible (and annoying!). Here's the relevant messages when 'configure' is executed by the ebuild:

> checking for sqlite 3 driver for PDO... yes
> checking for sqlite 3 support for PDO... no

and sqlite (v3) doesn't end up being a PDO driver.

A nice workaround is to edit /etc/portage/package.use in order to have "-pdo pdo_external -sqlite" for dev-lang/php and "sqlite" for dev-php5/pecl-pdo and then re-emerge php. It will automatically emerge pecl-pdo-sqlite and use it (make sure to restart apache2). This is probably a better way to have sqlite support anyway, since you can update the sqlite driver without having to recompile php.
Comment 3 Piter Elagin 2006-07-04 06:07:10 UTC
dev-php5/pecl-pdo - have bugs when i bind variable =(
___
when i can include "pdo" in original php ?
___
may be i can edit ebuild ?
Comment 4 Piter Elagin 2006-07-04 06:14:29 UTC
(In reply to comment #3)
> dev-php5/pecl-pdo - have bugs when i bind variable =(
> ___
> when i can include "pdo" in original php ?
> ___
> may be i can edit ebuild ?
> 
dev-php5/pecl-pdo(ver.1.0.2) - last update in 2005-11-28 =(
bug, when i use bind variables.
in pdo
insert into zzz values(:v1,:v2,:v3)
:v1 := 1,
:v2 := 2,
:v3 := 3
in oracle (after bind)
insert into zzz values(null,null,null)

=(((
Comment 5 Luca Longinotti (RETIRED) gentoo-dev 2006-07-14 08:35:32 UTC
USE="pdo sqlite" emerge dev-lang/php should correctly give you SQLite3 support now with the dev-lang/php-5.1.4-r4 release that should appear on the mirrors in a couple of hours, I wasn't anymore able to not have it compile without SQLite3 support (as it's intended to be).
Best regards, CHTEKK.
Comment 6 Thomas 2008-04-26 20:02:55 UTC
Hi,

I'm having the very same bug here. My php install has sqlite and pdo flags set :

[ebuild   R   ] dev-lang/php-5.2.6_rc4  USE="apache2 berkdb cgi cli crypt gdbm iconv ipv6 mysql ncurses nls pcre pdo readline reflection session spl sqlite ssl truetype unicode xml zlib -adabas -bcmath -birdstep -bzip2 -calendar -cdb -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -hash -imap -inifile -interbase -iodbc (-java-external) -json -kerberos -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pic -posix -postgres -qdbm -recode -sapdb -sharedext -sharedmem -simplexml -snmp -soap -sockets -solid -spell -suhosin -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip -zip-external" 0 kB 


> eix dev-db/sqlite
[D] dev-db/sqlite
     Available versions:  
	(0)	2.8.16-r4
	(3)	3.3.17 3.4.1 3.5.3 ~3.5.4
	{+threadsafe debug doc nls nothreadsafe soundex tcl}
     Installed versions:  2.8.16-r4(21:35:03 17.03.2008)(nls -doc -tcl)
			  3.5.6(3)(15:06:27 16.03.2008)(threadsafe -debug -doc -soundex -tcl)



but running 

> print_r(PDO::getAvailableDrivers());

returns me

> Array
> (
>     [0] => sqlite2
>     [1] => sqlite
>     [2] => mysql
> )

And just in case, when I install punbb with a SQLite backend, the generated database file is sqlite2.x format (can't open it with sqlite3)


checking the dependencies on sqlite, it seems to be right : sqlite + pdo -> sqlite-3*.

> equery d dev-db/sqlite

dev-lang/php-5.2.6_rc4 (sqlite? =dev-db/sqlite-2*)
                       (sqlite&pdo? =dev-db/sqlite-3*)

The workaround proposed in comment #2 isn't feasible anymore, and the final fix isn't helping.

------------

> emerge --info

Portage 2.1.4.4 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r3 i686)
=================================================================
System uname: 2.6.24-gentoo-r3 i686 AMD Athlon(tm) 64 Processor 3500+
Timestamp of tree: Sat, 26 Apr 2008 18:33:01 +0000
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.5.1-r5
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://213.186.33.37/gentoo-distfiles/"
LANG="fr_FR.UTF-8"
LC_ALL="fr_FR.UTF-8"
LINGUAS="fr"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/pro-audio /usr/portage/local/layman/musicbrainz /usr/portage/local/layman/haskell"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X acl alsa ao audiofile bash-completion berkdb cairo cli cracklib crypt dbus dri dssi dvdr emacs flac fortran gdbm gif gpm gtk hal iconv ipv6 isdnlog jack jackmidi jpeg ladspa lash libsamplerate mad midi mmx mp3 mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pcre perl png pppd python readline reflection session slang sndfile spl sqlite ssl svg tcpd tiff truetype unicode vorbis x86 xorg zlib" ALSA_CARDS="ice1712" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse ps2mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fr" USERLAND="GNU" VIDEO_CARDS="vesa mga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 7 Christian Hoffmann (RETIRED) gentoo-dev 2008-04-27 15:50:35 UTC
Hm yes, I am able to reproduce it. It is ok that 'print_r(PDO::getAvailableDrivers());' shows sqlite and sqlite2, but using sqlite should lead to a sqlite3 database while it apparently does not. php does not even link to libsqlite3... probably some autotools problem.
The problem is that we cannot easily fix that as it would probably break systems (iirc you have to manually convert from sqlite2 to sqlite3, right?), so we might have to delay the fix until some bigger change is necessary anyway (php-5.3 maybe? :/). Unless someone has any better idea...
Comment 8 Jamie Learmonth 2009-01-15 15:03:44 UTC
Not having any problems using the 5.2.X branch. Test Code:

$ USE="pdo sqlite" emerge =dev-lang/php-5.2.8

$ sqlite3 foo.db
> CREATE TABLE tbl (foo varchar(10));
> INSERT INTO tbl VALUES ('Hello World');
> .quit

test.php ->
<?php

var_dump(PDO::getAvailableDrivers());

$pdo = new PDO('sqlite:/home/jamiel/tmp/foo.db');
var_dump($pdo->query('SELECT * FROM tbl')->fetch());

Output ->

$ php test.php 
array(3) {
  [0]=>
  string(7) "sqlite2"
  [1]=>
  string(6) "sqlite"
  [2]=>
  string(5) "mysql"
}
array(2) {
  ["f1"]=>
  string(11) "Hello World"
  [0]=>
  string(11) "Hello World"
}

If you need to access a sqlite2 database you need to explicitly use sqlite2 in your DSN as documented at the following:

http://uk2.php.net/manual/en/ref.pdo-sqlite.connection.php
Comment 9 Christian Hoffmann (RETIRED) gentoo-dev 2009-12-16 20:32:53 UTC
I don't know why, but this problem does not seem reproducible anymore. Neither with 5.2* nor with 5.3*.
I'm closing it as WORKSFORME as such. Please provide feedback. Thanks.