[PHP 5.3] Sans PDO ?

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [PHP 5.3] Sans PDO ?

Re: [PHP 5.3] Sans PDO ?

par katagoto » 17 août 2009, 16:18

Aaaaaaah ! je l'ai anéantis, je l'ai laminé, renvoyé au big bang, ça marche, merci à tous.
Pour info, j'ai retéléchargé les sources, recompilé avec ces directives :

Code : Tout sélectionner

#!/bin/sh CFLAGS="-O2" ./configure --prefix=/usr/local \ --with-apxs2=/usr/local/bin/apxs \ --with-inifile=/usr/local/etc/php.ini \ --with-libxml-dir=/usr/local/src/php-5.3.0/ext/libxml \ --with-xsl \ --with-zlib \ --with-pdo-pgsql=/usr/local/src/php-5.3.0/ext/pdo_pgsql \ --with-pgsql=shared \ --enable-memcache \ --enable-APC
Encore merci, si vous voyez une anomalie dans ces directives, je suis preneur ;)

Merci à tous

Re: [PHP 5.3] Sans PDO ?

par stopher » 17 août 2009, 12:27

Hi ,

PDO est maintenant activé par défaut , tu n'as donc normalement même pas besoin de mettre
--enable-pdo \
--with-pdo-sqlite \
--with-sqlite \

Apres , que veux tu comme type de base ... sqlite ? mysql ? pgsql ? ou les trois ? pour activer les pilotes adéquates . ( le/les type de ddb choisis doivent être installé avant la compilation de php , les lib doivent être dispo )

Apres , ne t' acharnes pas , à tt mettre en shared .. d'autant que pour une lib que tu utilises souvent , et est théoriquement plus performante lorsqu'elle est compilé avec php .

Ch.

Re: [PHP 5.3] Sans PDO ?

par katagoto » 16 août 2009, 19:21

Tu me fais peur là...
J'ai regardé sur bug.php.net, il n'y a rien pour mon OS et ma version :/
Au pire, je ferais un rapport

Par avance merci de votre aide

PS : Je suis tout fier de mon bug, pour une fois je vais faire avancer PHP ^^
PPS : Sékiltoyai tu es pas à la pointe de la technique ? tu me déçoit...

Re: [PHP 5.3] Sans PDO ?

par Sékiltoyai » 16 août 2009, 18:56

Bah je te propose d'attendre la réponse de quelqu'un qui a php 5.3 installé…
Au pire regarde sur bugs.php.net s'il n'y a pas un rapport…

Re: [PHP 5.3] Sans PDO ?

par katagoto » 16 août 2009, 18:42

Alors
<?php
new PDO();
Donne :
Fatal error: Class 'PDO' not found in /var/www/index.php on line 2
Laisse mon code tranquille :lol:

Par avance merci de votre aide

Re: [PHP 5.3] Sans PDO ?

par Sékiltoyai » 16 août 2009, 18:21

Essaye avec un test (un simple new PDO() ) hors de toute classe ou namespace. Le truc le plus atomique possible.

Re: [PHP 5.3] Sans PDO ?

par katagoto » 16 août 2009, 17:51

Euh, ya pas de raison qu'ils enlèvent le support PDO de 5.2 à 5.3. Et puis tu crois qu'ils vont intégrer des pilotes PDO sans intégrer PDO ? Un peu de logique voyons.

Le problème doit venir de ton code, rien d'autre. Donc poste le.
Alors :
<?php
/**
 * Classe de "étendu" de PDO
 * 
 * @author Katagoto
 */

class TPDO
{
    /**
     * L'instance de PDO 
     * 
     * @var PDO 
     */ 

    private $lien;

    /**
     * Nombre de requêtes
     *
     * @var integer
     */

    public $NbRequete;

    /**
     * Nombre de temps total pour le sql
     *
     * @var integer
     */

    public $Temps;

    /**
     * Si le mode transactionnel est activé
     *
     * @var boolean
     */

    public $transaction = true;

    /**
     * Constringucteur de sql 
     * 
     * Tente une connexion au serveur de BD 
     * 
     * @param string $url 
     * @param string $login 
     * @param string $password 
     * @param string $nom 
     */ 

    public function __construct($url, $login, $password, $nom)
    {
        try
        {
            $temps = microtime(true);
            $this->lien = new PDO('postgresql:host='.$url.';dbname='.$nom, $login, $password, array(PDO::ATTR_PERSISTENT => true));
            $this->Temps += ($temps - microtime(true));
        }
        // ...
    }
}
Il est inclus dans fichier incluant un namespace avant.
export OPTIM=-02

O o jamais vu ca de ma vie chez moi on fait CFLAGS="-O2" mais enfin bref,

--enable-pdo=shared \ sert à rien il n'y a que les options propre à chaque moteur de base de donnée qui servent, en fait la plupart de tes options de configure sont fausses, as tu fait ./configure --help pour les sélectionner?
Bah, il y a un début à tout ^^
Si non, j'ai suivit le tutoriel de stopher en grande partie, si non la doc officielle.

Le nouveau :

Code : Tout sélectionner

#!/bin/sh CFLAGS="-O2"2 ./configure --prefix=/usr/local \ --with-apxs2=/usr/local/bin/apxs \ --with-inifile=/usr/local/etc/php.ini \ --with-libxml \ --with-xsl \ --with-zlib \ # --enable-pdo=shared \ # --with-pdo-sqlite=shared \ # --with-sqlite=shared \ --with-pdo-pgsql=shared \ --with-pgsql=shared \ --enable-memcache \ --enable-apc
Par contre la configuration plante (et le make après aussi) :
./conf_install: line 14: --with-pdo-pgsql=shared: command not found
Par avance merci de votre aide

Re: [PHP 5.3] Sans PDO ?

par Nagol » 10 août 2009, 15:41

export OPTIM=-02

O o jamais vu ca de ma vie chez moi on fait CFLAGS="-O2" mais enfin bref,

--enable-pdo=shared \ sert à rien il n'y a que les options propre à chaque moteur de base de donnée qui servent, en fait la plupart de tes options de configure sont fausses, as tu fait ./configure --help pour les sélectionner?

Re: [PHP 5.3] Sans PDO ?

par Sékiltoyai » 09 août 2009, 21:57

Euh, ya pas de raison qu'ils enlèvent le support PDO de 5.2 à 5.3. Et puis tu crois qu'ils vont intégrer des pilotes PDO sans intégrer PDO ? Un peu de logique voyons.

Le problème doit venir de ton code, rien d'autre. Donc poste le.

[PHP 5.3] Sans PDO ?

par katagoto » 09 août 2009, 21:17

Bonsoir à toutes et à tous,

Récemment, j'ai compilé PHP 5.3 sous Debian 5 avec comme configuration :

Code : Tout sélectionner

#!/bin/sh export OPTIM=-02 ./configure --prefix=/usr/local \ --with-apxs2=/usr/local/bin/apxs \ --with-inifile=/usr/local/etc/php.ini \ --with-libxml2 \ --with-xsl \ --with-zlib \ --enable-pdo=shared \ --with-pdo-sqlite=shared \ --with-sqlite=shared \ --with-pdo-pgsql=shared \ --with-pgsql=shared \ --enable-memcache \ --enable-APC
Jusque là tout va bien, j'ai ensuite redémarré apache et j'ai voulu tester mon code mais :
Fatal error: Class 'PDO' not found in ...
Je me suis dit que j'avais oublié de faire pecl install pdo puis pecl install PDO_PGSQL puis de modifier php.ini en conséquence, mais, impossible d'installer pdo :
downloading PDO-1.0.3.tgz ...
Starting to download PDO-1.0.3.tgz (52,613 bytes)
.............done: 52,613 bytes
12 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
building in /var/tmp/pear-build-root/PDO-1.0.3
running: /tmp/pear/temp/PDO/configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/m ain -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/inc lude/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-n on-zts-20090626
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable PDO support... yes, shared
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc static flag works... yes
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /var/tmp/pear-build-root/PDO-1.0.3/libtool --mode=compile cc -I. -I/tmp /pear/temp/PDO -DPHP_ATOM_INC -I/var/tmp/pear-build-root/PDO-1.0.3/include -I/va r/tmp/pear-build-root/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/local/include/p hp -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/incl ude/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/PDO/pdo.c -o pdo.lo
mkdir .libs
cc -I. -I/tmp/pear/temp/PDO -DPHP_ATOM_INC -I/var/tmp/pear-build-root/PDO-1.0.3 /include -I/var/tmp/pear-build-root/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/l ocal/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/ usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php /ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/PDO/pdo.c -fPIC -DPIC -o .libs/pdo.o
/bin/sh /var/tmp/pear-build-root/PDO-1.0.3/libtool --mode=compile cc -I. -I/tmp /pear/temp/PDO -DPHP_ATOM_INC -I/var/tmp/pear-build-root/PDO-1.0.3/include -I/va r/tmp/pear-build-root/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/local/include/p hp -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/incl ude/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/PDO/pdo_dbh.c -o pdo_dbh.lo
cc -I. -I/tmp/pear/temp/PDO -DPHP_ATOM_INC -I/var/tmp/pear-build-root/PDO-1.0.3 /include -I/var/tmp/pear-build-root/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/l ocal/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/ usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php /ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/PDO/pdo_dbh.c -fPIC -DPI C -o .libs/pdo_dbh.o
/tmp/pear/temp/PDO/pdo_dbh.c: In function 'pdo_stmt_instantiate':
/tmp/pear/temp/PDO/pdo_dbh.c:410: error: 'zval' has no member named 'refcount'
/tmp/pear/temp/PDO/pdo_dbh.c:411: error: 'zval' has no member named 'is_ref'
/tmp/pear/temp/PDO/pdo_dbh.c: In function 'pdo_stmt_construct':
/tmp/pear/temp/PDO/pdo_dbh.c:435: error: 'zend_fcall_info' has no member named ' object_pp'
/tmp/pear/temp/PDO/pdo_dbh.c:458: error: 'zend_fcall_info_cache' has no member n amed 'object_pp'
/tmp/pear/temp/PDO/pdo_dbh.c: In function 'zim_PDO_setAttribute':
/tmp/pear/temp/PDO/pdo_dbh.c:752: error: 'zval' has no member named 'refcount'
/tmp/pear/temp/PDO/pdo_dbh.c: In function 'zim_PDO_getAttribute':
/tmp/pear/temp/PDO/pdo_dbh.c:818: error: 'zval' has no member named 'refcount'
/tmp/pear/temp/PDO/pdo_dbh.c: In function 'pdo_hash_methods':
/tmp/pear/temp/PDO/pdo_dbh.c:1122: warning: assignment discards qualifiers from pointer target type
/tmp/pear/temp/PDO/pdo_dbh.c:1126: warning: assignment discards qualifiers from pointer target type
make: *** [pdo_dbh.lo] Erreur 1
ERROR: `make' failed
Pourtant phpinfo() me renvois :
System Linux reblochon 2.6.26-2-686 #1 SMP Sun Jun 21 04:57:38 UTC 2009 i686
Build Date Jul 22 2009 14:08:47
Configure Command './configure' '--prefix=/usr/local' '--with-apxs2=/usr/local/bin/apxs' '--with-inifile=/usr/local/etc/php.ini' '--with-libxml2' '--with-xsl' '--with-zlib' '--enable-pdo=shared' '--with-pdo-sqlite=shared' '--with-sqlite=shared' '--with-pdo-pgsql=shared' '--with-pgsql=shared' '--enable-memcache' '--enable-APC'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib
Loaded Configuration File (none)
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,NTS
PHP Extension Build API20090626,NTS
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
Zend Multibyte Support disabled
IPv6 Support enabled
Registered PHP Streams compress.zlib, php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports tcp, udp, unix, udg
Registered Stream Filters zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
D'où viens le problème ?
Que faire ?

Par avance merci de votre aide