Skip to content

SQLite3::loadExtension() in PHP 7 Appends Extra ".so" to Extension Filename #4542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
victorgveloso opened this issue Mar 17, 2025 · 0 comments

Comments

@victorgveloso
Copy link

From manual page: https://www.php.net/manual/en/sqlite3.loadextension.php


When using PHP 7’s SQLite3 extension, the method SQLite3::loadExtension() improperly appends an additional ".so" to the filename provided, leading to load failure. While the SQLite CLI correctly loads the SQLite3 extension without requiring any file extension (e.g., sqlite> .load ./libsqlite_hashes, thus automatically appending the extension when needed), PHP 8 requires specifying the file extension, e.g., SQLite3::loadExtension('libsqlite_hashes.so'). Lastly, PHP 7 fails to load the SQLite3 extension with or without specifying the file extension as it ends up looking for a file with a double extension (e.g., libsqlite_hashes.so.so).

Reproducing steps can be found at nyurik/sqlite-hashes#71

Notice that, loadExtension won't work in any PHP version (7 or 8) if the extension part of the SQLite 3 extension filename is omitted.

This behavior is not properly documented in the manual, which claims support for a broad range of PHP versions (PHP 5 >= 5.3.0, PHP 7, PHP 8) and do not emphasize the importance of specifying the file extension (e.g., .so for Linux).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant