PHP pdo_dblib extension fails to make and make install
We are migrating a customer website to our cPanel infrastructure, and some specific parts of his website need to connect to an external Sybase database. In their current infrastructure, they are using PHP 7.3 with pdo_dblib extension integrated with FreeTDS to access that database.
We already have FreeTDS installed on the cPanel server, so let's jump to pdo_dblib installation.
EasyApache 4 web interface doesn't have the option to install pdo_dblib, neither Yum repository has this extension, so I need to manually install it.
I tried to download pdo_dblib with PECL using the following command:
[CODE=bash]/opt/cpanel/ea-php73/root/usr/bin/pecl download pdo_dblib
I extracted the .tgz file, entered the folder, and ran the following commands to prepare the compilation (as I have done to other extensions not available in EasyApache 4 web interface): [CODE=bash]/opt/cpanel/ea-php73/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
In the last command, it returns the following error: [CODE=bash]checking for PDO_DBLIB support via FreeTDS... yes, shared configure: error: Cannot find FreeTDS in known installation directories
I could fix that, by specifying the --with-pdo-dblib parameter, as follows: [CODE=bash]./configure --with-pdo-dblib=/usr/local/freetds --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
But, when I run
make it returns this error: [CODE=bash]/root/PDO_DBLIB-1.0/pdo_dblib.c:37:1: error: unknown type name 'function_entry' function_entry pdo_dblib_functions[] = { ^ /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: braces around scalar initializer [enabled by default] {NULL, NULL, NULL} ^ /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: initialization makes integer from pointer without a cast [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: excess elements in scalar initializer [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: excess elements in scalar initializer [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:62:2: warning: initialization from incompatible pointer type [enabled by default] pdo_dblib_functions, ^ /root/PDO_DBLIB-1.0/pdo_dblib.c:62:2: warning: (near initialization for 'pdo_dblib_module_entry.functions') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c: In function 'zm_startup_pdo_dblib': /root/PDO_DBLIB-1.0/pdo_dblib.c:196:2: warning: passing argument 1 of 'dbmsghandle' from incompatible pointer type [enabled by default] dbmsghandle(msg_handler); ^ In file included from /usr/local/freetds/include/sybfront.h:23:0, from /root/PDO_DBLIB-1.0/php_pdo_dblib_int.h:45, from /root/PDO_DBLIB-1.0/pdo_dblib.c:32: /usr/local/freetds/include/sybdb.h:599:13: note: expected 'MHANDLEFUNC' but argument is of type 'int (*)(struct DBPROCESS *, DBINT, int, int, char *, char *, char *, DBUSMALLINT)' MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler); ^ make: *** [pdo_dblib.lo] Error 1
I've searched and found , extracted the source, entered the
directory, and ran the same commands as before. But now,
command return this error: [CODE=bash]/root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c: In function 'pdo_dblib_stmt_should_stringify_col': /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:290:35: error: 'DBBIGINT' undeclared (first use in this function) if (sizeof(zend_long) < sizeof(DBBIGINT)) { ^ /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:290:35: note: each undeclared identifier is reported only once for each function it appears in In file included from /opt/cpanel/ea-php73/root/usr/include/php/Zend/zend.h:27:0, from /opt/cpanel/ea-php73/root/usr/include/php/main/php.h:33, from /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:24: /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c: In function 'pdo_dblib_stmt_get_col': /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:433:22: error: 'DBBIGINT' undeclared (first use in this function) ZVAL_LONG(zv, *(DBBIGINT *) data); ^ /opt/cpanel/ea-php73/root/usr/include/php/Zend/zend_types.h:745:19: note: in definition of macro 'ZVAL_LONG' Z_LVAL_P(__z) = l; \ ^ /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:433:32: error: expected expression before ')' token ZVAL_LONG(zv, *(DBBIGINT *) data); ^ /opt/cpanel/ea-php73/root/usr/include/php/Zend/zend_types.h:745:19: note: in definition of macro 'ZVAL_LONG' Z_LVAL_P(__z) = l; \ ^ make: *** [dblib_stmt.lo] Error 1
I've searched a lot and couldn't find anything to help with this error. Worth mentioning that we tried to recompile FreeTDS with both
and
options, but that didn't change the
command output. I also tried to ignore the errors with
, but when I ran
a similar error was outputted. Even trying
gave errors: [CODE=bash]make: [/root/php-7.3.25/ext/pdo_dblib/modules/pdo_dblib.la] Error 1 (ignored) Installing shared extensions: /opt/cpanel/ea-php73/root/usr/lib64/php/modules/ cp: cannot stat 'modules/*': No such file or directory make: [install-modules] Error 1 (ignored)
I extracted the .tgz file, entered the folder, and ran the following commands to prepare the compilation (as I have done to other extensions not available in EasyApache 4 web interface): [CODE=bash]/opt/cpanel/ea-php73/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
In the last command, it returns the following error: [CODE=bash]checking for PDO_DBLIB support via FreeTDS... yes, shared configure: error: Cannot find FreeTDS in known installation directories
I could fix that, by specifying the --with-pdo-dblib parameter, as follows: [CODE=bash]./configure --with-pdo-dblib=/usr/local/freetds --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
But, when I run
makemake it returns this error: [CODE=bash]/root/PDO_DBLIB-1.0/pdo_dblib.c:37:1: error: unknown type name 'function_entry' function_entry pdo_dblib_functions[] = { ^ /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: braces around scalar initializer [enabled by default] {NULL, NULL, NULL} ^ /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: initialization makes integer from pointer without a cast [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: excess elements in scalar initializer [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: excess elements in scalar initializer [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:38:2: warning: (near initialization for 'pdo_dblib_functions[0]') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c:62:2: warning: initialization from incompatible pointer type [enabled by default] pdo_dblib_functions, ^ /root/PDO_DBLIB-1.0/pdo_dblib.c:62:2: warning: (near initialization for 'pdo_dblib_module_entry.functions') [enabled by default] /root/PDO_DBLIB-1.0/pdo_dblib.c: In function 'zm_startup_pdo_dblib': /root/PDO_DBLIB-1.0/pdo_dblib.c:196:2: warning: passing argument 1 of 'dbmsghandle' from incompatible pointer type [enabled by default] dbmsghandle(msg_handler); ^ In file included from /usr/local/freetds/include/sybfront.h:23:0, from /root/PDO_DBLIB-1.0/php_pdo_dblib_int.h:45, from /root/PDO_DBLIB-1.0/pdo_dblib.c:32: /usr/local/freetds/include/sybdb.h:599:13: note: expected 'MHANDLEFUNC' but argument is of type 'int (*)(struct DBPROCESS *, DBINT, int, int, char *, char *, char *, DBUSMALLINT)' MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler); ^ make: *** [pdo_dblib.lo] Error 1
I've searched and found , extracted the source, entered the
ext/pdo_dblib/directory, and ran the same commands as before. But now,
makecommand return this error: [CODE=bash]/root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c: In function 'pdo_dblib_stmt_should_stringify_col': /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:290:35: error: 'DBBIGINT' undeclared (first use in this function) if (sizeof(zend_long) < sizeof(DBBIGINT)) { ^ /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:290:35: note: each undeclared identifier is reported only once for each function it appears in In file included from /opt/cpanel/ea-php73/root/usr/include/php/Zend/zend.h:27:0, from /opt/cpanel/ea-php73/root/usr/include/php/main/php.h:33, from /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:24: /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c: In function 'pdo_dblib_stmt_get_col': /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:433:22: error: 'DBBIGINT' undeclared (first use in this function) ZVAL_LONG(zv, *(DBBIGINT *) data); ^ /opt/cpanel/ea-php73/root/usr/include/php/Zend/zend_types.h:745:19: note: in definition of macro 'ZVAL_LONG' Z_LVAL_P(__z) = l; \ ^ /root/php-7.3.25/ext/pdo_dblib/dblib_stmt.c:433:32: error: expected expression before ')' token ZVAL_LONG(zv, *(DBBIGINT *) data); ^ /opt/cpanel/ea-php73/root/usr/include/php/Zend/zend_types.h:745:19: note: in definition of macro 'ZVAL_LONG' Z_LVAL_P(__z) = l; \ ^ make: *** [dblib_stmt.lo] Error 1
I've searched a lot and couldn't find anything to help with this error. Worth mentioning that we tried to recompile FreeTDS with both
--enable-msdbliband
--enable-sybase-compatoptions, but that didn't change the
makecommand output. I also tried to ignore the errors with
make -i, but when I ran
make installa similar error was outputted. Even trying
make install -igave errors: [CODE=bash]make: [/root/php-7.3.25/ext/pdo_dblib/modules/pdo_dblib.la] Error 1 (ignored) Installing shared extensions: /opt/cpanel/ea-php73/root/usr/lib64/php/modules/ cp: cannot stat 'modules/*': No such file or directory make: [install-modules] Error 1 (ignored)
-
That compilation problem was slowing the whole project down so I did something easier. Remi PHP repository has the pdo_dblib extension already compiled for various PHP versions, so in another server (to not interfere with EasyApache PHP packages) I've downloaded PHP 7.3.25 (had to specify the version as in Remi repository it is already in 7.3.26) and pdo_dblib extension. Then I moved the .so file to the cPanel server, enabled it in the .ini, restarted PHP-FPM, and voil", pdo_dblib was successfully loaded and working as expected. In any case, if someone knows what is happening with the compilation process, please post it here so that it may help others with the same problem. 0 -
Hey there! I followed these same steps on my end and when I got to this point: ./configure --with-pdo-dblib=/usr/local/freetds --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
I received the following error:configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory
Can you check your output from that command and see if you also received that message?0 -
Hey there! I followed these same steps on my end and when I got to this point:
./configure --with-pdo-dblib=/usr/local/freetds --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
I received the following error:configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory
Can you check your output from that command and see if you also received that message?
I didn't receive that message. I did not install FreeTDS throughea-freetds
package, but I manually downloaded its source and compiled it, installing it to the/usr/local/freetds
directory. PS: Use--prefix
option when configuring FreeTDS to specify the installation directory. Example:./configure --prefix=/usr/local/freetds0 -
I can confirm that those errors do not happen with Remi PHP packages, but only with cPanel (EasyApache 4). 0 -
Ah - that would be the difference then, as the cPanel install of FreeTDS doesn't use that directory path by default. Since these are third-party packages I'm hesitant to say this is an issue with cPanel, as not every external package will work with EasyApache. I think the best thing to do in this case would be to submit a feature request using the link in my signature below to get that functionality added directly to the product. 0
Please sign in to leave a comment.
Comments
5 comments