sqlite PDO on apache - dynamic modules are not supported

Alles, was PHP betrifft, kann hier besprochen werden.

sqlite PDO on apache - dynamic modules are not supported

Postby CMaurer » 12. December 2008 13:33

This is on a cross-compiled httpd 2.2.4 + PHP 5.2.6 for Linux PPC.

I cannot get the pdo_sqlite.so to work.
I want to do
<?php
$dbh = new PDO('sqlite:/tmp/data.sqlite');
?>

I compiled PHP using
./configure --build=i386-linux --host=ppc-linux \
--with-apxs2=/home/user/wwwroot/bin/apxs \
--with-config-file-path=/home/user/wwwroot/php \
--disable-all \
--prefix=/home/user/wwwroot \
--enable-session \
--with-zlib --enable-pdo=shared --with-pdo-sqlite=shared --with-sqlite=shared

my php.ini is
display_errors = On
log_errors = On
display_startup_errors = On
log_errors = On
error_log = /home/user/wwwroot/logs/phperror.log
extension_dir=/home/user/wwwroot/lib/php/extensions/no-debug-non-zts-20060613
extension=pdo.so
extension=pdo_sqlite.so

The pdo.so and pdo_sqlite.so are all in the correct directory.
phpinfo(); displays 'PDO drivers=no value' in the PDO section, but also 'Dynamic Library support not available' under section 'standard'.
The php error log displays
[12-Dec-2008 12:50:17] PHP Warning: PHP Startup: Cannot dynamically load pdo.so - dynamic modules are not supported in Unknown on line 0
[12-Dec-2008 12:50:17] PHP Warning: PHP Startup: Cannot dynamically load pdo_sqlite.so - dynamic modules are not supported in Unknown on line 0

Code: Select all
<?php
$dbh = new PDO('sqlite:/tmp/daten.sqlite');
foreach ($dbh->query('SELECT * FROM Staedte') as $row)
?>

causes this error:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /home/user/wwwroot/htdocs/db.php:2 Stack trace: #0 /home/user/wwwroot/htdocs/db.php(2): PDO->__construct('sqlite:/tmp/dat...') #1 {main} thrown in /home/user/wwwroot/htdocs/db.php on line 2


which seems to indicate that PDO is somehow known. I searched for hours, but I haven't understood how this works.
What must I do to enable this? How do I enable 'Dynamic Library support'?
CMaurer
 
Posts: 4
Joined: 14. November 2008 10:36

Re: sqlite PDO on apache - dynamic modules are not supported

Postby CMaurer » 15. December 2008 11:12

Solved.(?) This is some configure weirdness.
When configure is checking for
checking for dlopen... no
checking for __dlopen... no
checking for dlopen in -ldl... yes

it somehow disables all DL stuff when cross compiling with these lines
if test "$found" = "yes"; then
ac_libs=$LIBS
LIBS="$LIBS -ldl"

if test "$cross_compiling" = yes; then
found=no

else
...

This way all kinds of HAVE_LIBDL, HAVE_DLOPEN etc macros are not defined and functions php_dl() and PHP_MINFO_FUNCTION() in
ext/standard/dl.c will be empty versions:
#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
..
#else
void php_dl(zval *file, int type, zval *return_value, int start_now TSRMLS_DC)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file));
RETURN_FALSE;
}

PHP_MINFO_FUNCTION(dl)
{
PUTS("Dynamic Library support not available<br />.\n");
}
#endif

I uncommented those lines in configure and pdo.so and pdo_sqlite.so are now loaded.
CMaurer
 
Posts: 4
Joined: 14. November 2008 10:36


Return to PHP

Who is online

Users browsing this forum: No registered users and 4 guests