tursodatabase / turso-client-php

Turso + PHP - libSQL Extension for PHP
https://turso.tech/php
MIT License
54 stars 5 forks source link

[Bug]: Unable to load dynamic library #8

Open mboisvertdupras opened 1 month ago

mboisvertdupras commented 1 month ago

Description

After going through the steps in the documentation, I'm unable to start/restart my php process because of an error loading the liblibsql_php.so library.

Minimal Reproduction

composer global require darkterminal/turso-php-installer turso-php-installer install valet restart

Exception or Error

Unable to load dynamic library '/Users//.turso-client-php/liblibsql_php.so' (tried: /Users//.turso-client-php/liblibsql_php.so (dlopen(/Users//.turso-client-php/liblibsql_php.so, 0x0009): symbol not found in flat namespace '_sqlite3_wal_manager')

darkterminal commented 1 month ago

Unable to load dynamic library '/Users//.turso-client-php/liblibsql_php.so' (tried: /Users//.turso-client-php/liblibsql_php.so (dlopen(/Users//.turso-client-php/liblibsql_php.so, 0x0009): symbol not found in flat namespace '_sqlite3_wal_manager')

When viewed from the error that appears here, extension is not directed to the right location. It's should:

/Users/<your-username>/.turso-client-php/liblibsql_php.so

When you ls -la | grep .turso from your $HOME, it's should look something like this:

> ls -la | grep .turso
drwxrwxr-x   2 username username      4096 Sep 20 15:48 .turso-client-php

> ls ~/.turso-client-php
liblibsql_php.so  libsql_php_extension.stubs.php

And when it's failed to load, you need to add the relative path:

# php.ini
extension=/Users/<your-username>/.turso-client-php/liblibsql_php.so
mboisvertdupras commented 1 month ago

It's odd that an extra / is added because this is what I have in my php.ini: extension=/Users/user/.turso-client-php/liblibsql_php.so

And this is the output of the 2 commands:

❯ ls -la | grep .turso 
drwxr-xr-x    6 user  staff       192 22 Sep 11:24 .turso-client-php

~ 
❯ ls ~/.turso-client-php
liblibsql_php.dylib     liblibsql_php.so        libsql_php_extension.stubs.php