brefphp / extra-php-extensions

Community-maintained extra PHP extensions usable in AWS Lambda with the Bref PHP runtimes.
https://bref.sh/docs/environment/php.html#extra-extensions
213 stars 110 forks source link

libmsodbcsql-17.10.so.1.1 not found #418

Closed ddeboer closed 1 year ago

ddeboer commented 1 year ago

On the Bref 2 sqlsrv image:

An exception occurred in the driver: SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.1.1' : file not found
mnapoli commented 1 year ago

A good first step would be to update the tests to reproduce that, then we can iterate on the Dockerfile.

https://github.com/brefphp/extra-php-extensions/blob/master/layers/sqlsrv/test.php

Would you be able to find a way for that?

ddeboer commented 1 year ago

Sorry, I don’t have time to work on this right now.

chrishanline commented 1 year ago

If you update line 20 of the test to:

if ($error['SQLSTATE'] == '01000' || $error['SQLSTATE'] == 'IM002') {

You'll see an ODBC error:

FAIL: sqlsrv extension library not loaded. [unixODBC][Driver Manager]Data source name not found, and no default driver specified

I'm not sure the new /bref/lib-copy/copy-dependencies.php build script is able to find the ODBC msodbcsql17 related required items for sqlsrv.

https://github.com/brefphp/extra-php-extensions/commit/5df91887f1f4b9aeeb3ecad619188c03686dd9f9#diff-d77e3926c770c1172da8a93d628d39aa7d6c5a9f078026d335ab62434418dbc7L23-L38

We most likely need to pull in some (all?) of those paths still.

mnapoli commented 1 year ago

👍 we could manually copy files that are not detected automatically by /bref/lib-copy/copy-dependencies.php

MohamedEL-Torky commented 1 year ago

Any updates on this issue, I'm facing the same problem

SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.1.1' : file not found

ddeboer commented 1 year ago

👍 we could manually copy files that are not detected automatically by /bref/lib-copy/copy-dependencies.php

@mnapoli copy-dependencies.php seems to be gone, or I’m overlooking it. Has this been changed in the meantime?

mnapoli commented 1 year ago

@ddeboer it should still be there, it is used by Bref itself: https://github.com/brefphp/aws-lambda-layers/blob/2f4b3f300d559b26cbd9c86bf9ee3f6bd2a6e839/php-80/Dockerfile#L441

buddhaCode commented 1 year ago

I am facing the same issue. Any news on this? How can I help? I just updated a project from bref v1 to v2.

ddeboer commented 1 year ago

@buddhaCode Please review/test the PR at #474.

buddhaCode commented 1 year ago

@ddeboer Sorry. Took me a while to make a picture of it. But I can confirm that these changes fixes the issue.

ddeboer commented 1 year ago

No worries @buddhaCode! Thank you for taking the time to test this. A cleaned-up PR is available at #479, but the fix is similar.