php-firebird icon indicating copy to clipboard operation
php-firebird copied to clipboard

ibase_service_attach doesn't allow local connection to Services API

Open avp-novgorod opened this issue 2 years ago • 19 comments

Function ibase_service_attach always use the connection pattern "%s:service_mgr" which initiates TCP/IP connection. However for local connection it must be "service_mgr". Possible solution: to check if parameter $host is empty to use the pattern for local connection.

avp-novgorod avatar Oct 18 '23 18:10 avp-novgorod

@avp-novgorod what exactly is the problem here? I've tried

ibase_service_attach("", $user, $password);
$fb_version_str = ibase_server_info($se, IBASE_SVC_SERVER_VERSION);

Works for me. No running server instances.

mlazdans avatar Oct 13 '25 14:10 mlazdans

Which version of fbclient.dll do you use in php? I have test embebbed fbclient.dll 2.0.7 for Windows and get error: ibase_service_attach(): Unable to complete network request to host "AVP". Failed to establish a connection. where AVP is my computer name.

avp-novgorod avatar Oct 13 '25 15:10 avp-novgorod

Where did you get that?

From this package and then renamed fbembed.dll to fbclient.dll? Image

mlazdans avatar Oct 13 '25 15:10 mlazdans

What PHP version you are using? PHP 7.3 / 8.4 gives me this error when using with embeded.dll

Image

mlazdans avatar Oct 13 '25 16:10 mlazdans

From this package and then renamed fbembed.dll to fbclient.dll?

Yes, exactly.

I test with php 8.2

The function fb_get_master_interface arises in 3.0 fbclient.dll

avp-novgorod avatar Oct 13 '25 16:10 avp-novgorod

What do you get from php -i | grep "Run-time Client Library Version"

mlazdans avatar Oct 13 '25 16:10 mlazdans

It feels like you are using more recent fbclient than 2.0.7

mlazdans avatar Oct 13 '25 16:10 mlazdans

Is not clear which php module strongly requires function fb_get_master_interface at your php-config. By default php-firebird and php-pdo work fine with Firebird 2.0 client dll.

avp-novgorod avatar Oct 13 '25 19:10 avp-novgorod

Can you please check php -i output about FB client libs? Or phpinfo() from web?

mlazdans avatar Oct 13 '25 19:10 mlazdans

Core

PHP Version	8.2.3

interbase

Firebird/InterBase Support	dynamic
Interbase extension version	3.0.1
Compile-time Client Library Version	Firebird API version 30
Run-time Client Library Version	WI-V6.3.7.13318 Firebird 2.0

PDO

PDO support	enabled
PDO drivers	firebird

PDO_Firebird

PDO Driver for Firebird	enabled
Client Library Version	WI-V6.3.7.13318 Firebird 2.0

avp-novgorod avatar Oct 14 '25 11:10 avp-novgorod

Btw isc_service_attach() is even supposed to work with embedded?

mlazdans avatar Oct 15 '25 13:10 mlazdans

Yes, should work. In old version there was an fbembed.dll for that. Now we only have fbclient.dll (.so on Linux)

MartinKoeditz avatar Oct 15 '25 14:10 MartinKoeditz

fb_get_master_interface() is comming from fbclient3 and onwards. If needed support for 2.0.x it has to be compiled against older 2.0.x client libraries. Not sure I want to deal with that now.

fb3+ isc_service_attach() indeed works in embed mode.

mlazdans avatar Oct 15 '25 14:10 mlazdans

2.0 and 2.5 are EOL. So no need to work on that.

MartinKoeditz avatar Oct 15 '25 14:10 MartinKoeditz

Local connection is not equal to embedded client. Pattern "%s:service_mgr" selects network access. However "service_mgr" select local connection to the server in same machine. It is not documented how isc_service_attach() will work with empty host.

avp-novgorod avatar Oct 21 '25 18:10 avp-novgorod

fb_get_master_interface() is comming from fbclient3 and onwards.

Please clarify what module required new firebird interface ? Since which version?

avp-novgorod avatar Oct 21 '25 18:10 avp-novgorod

I was actually used from extension itself. I added it when added support for new types. It is actually only needed #if FB_API_VER >= 40 so I already put it under a guard (dc2865358de80d29636b09ee9456518f72ef2afb). So now when compiling extension against FB client libs older than 4 this won't be used. At least at this moment.

mlazdans avatar Oct 21 '25 19:10 mlazdans

Do you mean that by default FB3.0 is unsupported now?

avp-novgorod avatar Oct 22 '25 14:10 avp-novgorod

No, I do not mean that. Just that some implementation details regarding Firebird 4.0+ needlessly leaked into 3.0 and 2.0. Don't worry about this.

mlazdans avatar Oct 22 '25 15:10 mlazdans

@avp-novgorod could you test with RC.1?

mlazdans avatar Nov 07 '25 21:11 mlazdans