|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-06-20 09:58 UTC] kaspernj at gmail dot com
Description:
------------
After succesfully compiling PHP 5.3 RC4 with PDO and PDO-SQLite, I ran a test-script to test all the shared extensions.
When trying to load the PDO-SQLite extension, I get the following error:
Warning: dl(): Unable to load dynamic library '.../pdo_sqlite.so' - .../pdo_sqlite.so: undefined symbol: sqlite3_libversion in ../test.php on line 5
Everything was compiled as shared extensions and loaded through a CLI script with dl().
Reproduce code:
---------------
#!/opt/php53/bin/php
<?php
dl("gd.so");
dl("pdo.so");
dl("pdo_sqlite.so");
echo("Hejsa\n");
?>
Expected result:
----------------
Hejsa
Actual result:
--------------
Warning: dl(): Unable to load dynamic library '.../pdo_sqlite.so' - .../pdo_sqlite.so: undefined symbol: sqlite3_libversion in ../test.php on line 5
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 06:00:01 2025 UTC |
"sqlite3.so" loads fine. It does not help to load "pdo_sqlite.so" afterwards though - getting the exact same error. Here is what I did: #!/opt/php53/bin/php <?php dl("gd.so"); dl("sqlite3.so"); dl("pdo.so"); dl("pdo_sqlite.so"); echo("Hejsa\n"); ?>I have the same problem with suse 10.x 32/64 bit using php 5.3.0/1 stable. My configure is: cd "/home/worker/download/php-5.3.1" ./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mm \ --with-mysql=shared,/usr/local \ --with-mysqli=shared,/usr/local/bin/mysql_config \ --with-sqlite=shared \ --with-sqlite3=shared \ --enable-pdo=shared \ --with-pdo-mysql=shared,/usr/local \ --with-pdo-sqlite=shared \ --with-libxml-dir=/usr/local/lib \ --enable-soap \ --with-zlib \ --disable-cgi \ --with-gd=shared \ --with-freetype-dir \ --with-jpeg-dir=/usr/lib \ --enable-gd-native-ttf \ --enable-exif \ --with-xsl \ --with-mcrypt \ --with-openssl \ --enable-mbstring \ --enable-mbregex \ --enable-ftp=shared \ --with-kerberos \ --enable-zip And extension order: extension=pdo.so extension=sqlite.so extension=sqlite3.so extension=mysql.so extension=mysqli.so extension=pdo_mysql.so extension=pdo_sqlite.so Additionally if I load sqlite.so before pdo.so than I get 1 more error: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/sqlite.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/sqlite.so: undefined symbol: php_pdo_unregister_driver in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/sqlite.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/sqlite.so: undefined symbol: php_pdo_unregister_driver in Unknown on line 0The problem is that pdo_sqlite compiles against the embedded copy of sqlite3 but doesn't include the sqlite3 object files in the final pdo_sqlite.so. Ugly patch directly against the configure script: --- php-5.3.3.orig/configure 2010-07-21 05:53:06.000000000 -0500 +++ php-5.3.3/configure 2010-10-14 09:40:17.000000000 -0500 @@ -75183,6 +75183,12 @@ else # use bundled libs + + # This change is anchored here to avoid patch being misapplied. This really only needs to be added + # when pdo_sqlite is compiled shared and using the bundled sqlite3. It shouldn't hurt so long as the + # bundled sqlite3 is used though. + shared_objects_pdo_sqlite="$shared_objects_pdo_sqlite ext/sqlite3/libsqlite/sqlite3.lo" + if test "$enable_maintainer_zts" = "yes"; then threadsafe_flags="-DSQLITE_THREADSAFE=1" else