pdo_sqlsrv 5.6.1
Microsoft SQL Server 2017 (RTM-CU14) (KB4484710) - 14.0.3076.1 (X64)
CentOS Linux 7
PHP Version 7.3.4 (OpenLiteSpeed 1.4.46)
ODBC Driver 17 for SQL Server
Compiling a build of the latest release pdo_sqlsrv using OpenLiteSpeed's PHP 7.3 libraries results in errors.
A successful build is expected. However, in running make test, I see the following:
> make test
/bin/sh /root/pdo_sqlsrv-4.3.0/libtool --mode=compile g++ -I/usr/local/lsws/lsphp73/include/php/ext -std=c++11 -I. -I/root/pdo_sqlsrv-4.3.0 -DPHP_ATOM_INC -I/root/pdo_sqlsrv-4.3.0/include -I/root/pdo_sqlsrv-4.3.0/main -I/root/pdo_sqlsrv-4.3.0 -I/usr/local/lsws/lsphp73/include/php -I/usr/local/lsws/lsphp73/include/php/main -I/usr/local/lsws/lsphp73/include/php/TSRM -I/usr/local/lsws/lsphp73/include/php/Zend -I/usr/local/lsws/lsphp73/include/php/ext -I/usr/local/lsws/lsphp73/include/php/ext/date/lib -I/root/pdo_sqlsrv-4.3.0/shared -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /root/pdo_sqlsrv-4.3.0/pdo_dbh.cpp -o pdo_dbh.lo
libtool: compile: g++ -I/usr/local/lsws/lsphp73/include/php/ext -std=c++11 -I. -I/root/pdo_sqlsrv-4.3.0 -DPHP_ATOM_INC -I/root/pdo_sqlsrv-4.3.0/include -I/root/pdo_sqlsrv-4.3.0/main -I/root/pdo_sqlsrv-4.3.0 -I/usr/local/lsws/lsphp73/include/php -I/usr/local/lsws/lsphp73/include/php/main -I/usr/local/lsws/lsphp73/include/php/TSRM -I/usr/local/lsws/lsphp73/include/php/Zend -I/usr/local/lsws/lsphp73/include/php/ext -I/usr/local/lsws/lsphp73/include/php/ext/date/lib -I/root/pdo_sqlsrv-4.3.0/shared -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /root/pdo_sqlsrv-4.3.0/pdo_dbh.cpp -fPIC -DPIC -o .libs/pdo_dbh.o
In file included from /usr/local/lsws/lsphp73/include/php/Zend/zend.h:27:0,
from /usr/local/lsws/lsphp73/include/php/main/php.h:33,
from /root/pdo_sqlsrv-4.3.0/shared/core_sqlsrv.h:34,
from /root/pdo_sqlsrv-4.3.0/php_pdo_sqlsrv.h:23,
from /root/pdo_sqlsrv-4.3.0/pdo_dbh.cpp:20:
/root/pdo_sqlsrv-4.3.0/shared/core_sqlsrv.h: In function 'void core::sqlsrv_array_init(sqlsrv_context&, zval*)':
/usr/local/lsws/lsphp73/include/php/Zend/zend_types.h:792:24: error: expected id-expression before 'do'
#define ZVAL_ARR(z, a) do { \
^
/usr/local/lsws/lsphp73/include/php/Zend/zend_API.h:377:28: note: in expansion of macro 'ZVAL_ARR'
#define array_init(arg) ZVAL_ARR((arg), zend_new_array(0))
^
/root/pdo_sqlsrv-4.3.0/shared/core_sqlsrv.h:2243:20: note: in expansion of macro 'array_init'
int zr = ::array_init(new_array);
^
/usr/local/lsws/lsphp73/include/php/Zend/zend_types.h:797:4: error: expected ',' or ';' before 'while'
} while (0)
^
/usr/local/lsws/lsphp73/include/php/Zend/zend_API.h:377:28: note: in expansion of macro 'ZVAL_ARR'
#define array_init(arg) ZVAL_ARR((arg), zend_new_array(0))
^
/root/pdo_sqlsrv-4.3.0/shared/core_sqlsrv.h:2243:20: note: in expansion of macro 'array_init'
int zr = ::array_init(new_array);
^
/root/pdo_sqlsrv-4.3.0/pdo_dbh.cpp: In function 'int pdo_sqlsrv_db_handle_factory(pdo_dbh_t*, zval*)':
/root/pdo_sqlsrv-4.3.0/pdo_dbh.cpp:505:34: error: 'ZVAL_INTERNAL_DTOR' was not declared in this scope
ZVAL_INTERNAL_DTOR, 0 /*persistent*/ TSRMLS_CC );
^
make: *** [pdo_dbh.lo] Error 1
@hifihedgehog for some reason your build log shows that you were compiling our old version 4.3.0, which didn't support PHP 7.3...
Also, please check your compiler version. See related issue #982
Sorry. The same results appear with either release. In backtrailing and trying earlier releases, I miscopied and pasted the results. However, the issue remains with LSPHP regardless of the release.
@hifihedgehog please double check because the following error should not occur with the latest version
note: in expansion of macro 'array_init'
int zr = ::array_init(new_array);
As mentioned above, please also check your compiler version. See related issue #982
I used the terminal command snippet...
sudo yum install centos-release-scl
sudo yum install devtoolset-7
scl enable devtoolset-7 bash
...followed by...
A. wget https://pecl.php.net/get/pdo_sqlsrv-5.6.1.tgz
B. tar -zxvf pdo_sqlsrv-5.6.1.tgz
C. cd pdo_sqlsrv-5.6.1
D. /usr/local/lsws/lsphp73/bin/phpize
E. ./configure --with-php-config=/usr/local/lsws/lsphp73/bin/php-config
F. make
E. make test
...and I am not seeing any tests as having run. Is this normal?
PHP : /usr/local/lsws/lsphp73/bin/php
Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /root/pdo_sqlsrv-5.6.1/modules/pdo_sqlsrv.so (/root/pdo_sqlsrv-5.6.1/modules/pdo_sqlsrv.so: undefined symbol: php_pdo_register_driver), /root/pdo_sqlsrv-5.6.1/modules/pdo_sqlsrv.so.so (/root/pdo_sqlsrv-5.6.1/modules/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP_SAPI : cli
PHP_VERSION : 7.3.4
ZEND_VERSION: 3.3.4
PHP_OS : Linux - Linux [REDACTED] 3.10.0-957.12.1.el7.x86_64 #1 SMP Mon Apr 29 14:59:59 UTC 2019 x86_64
INI actual : /root/pdo_sqlsrv-5.6.1/tmp-php.ini
More .INIs :
CWD : /root/pdo_sqlsrv-5.6.1
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2019-05-01 17:40:21
=====================================================================
No tests were run.
@hifihedgehog
Did you get compilation errors this time?
How about sudo make install?
Have you checked whether pdo_sqlsrv.so is copied to the right place? Please check php --ini too
Did you get compilation errors this time?
The above was what I got with make test.
This is what I get running make:
# ./configure --with-php-config=/usr/local/lsws/lsphp73/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local/lsws/lsphp73
checking for PHP includes... -I/usr/local/lsws/lsphp73/include/php -I/usr/local/lsws/lsphp73/include/php/main -I/usr/local/lsws/lsphp73/include/php/TSRM -I/usr/local/lsws/lsphp73/include/php/Zend -I/usr/local/lsws/lsphp73/include/php/ext -I/usr/local/lsws/lsphp73/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lsws/lsphp73/lib64/php/modules
checking for PHP installed headers prefix... /usr/local/lsws/lsphp73/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for pdo_sqlsrv support... yes, shared
checking for PDO includes... checking for PDO includes... /usr/local/lsws/lsphp73/include/php/ext
checking for PDO_SQLSRV headers... ./shared/
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld
checking if the linker (/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /opt/rh/devtoolset-7/root/usr/bin/nm -B
checking the name lister (/opt/rh/devtoolset-7/root/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /opt/rh/devtoolset-7/root/usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld -m elf_x86_64
checking if the linker (/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
pdo.sqlsrv.so is indeed copied to the right location. I see it under "/usr/local/lsws/lsphp73/lib64/php/modules/". As I do with other extensions, I add it via a single line containing "extension=*.so," where * is the name of the extension, to my php.ini file. But I don't see this reflected as active or available in my PHP 7.3 extensions, either, after adding it to the main LSPHP 7.3 .ini file. You can verify this here:
[REDACTED]
I removed the extension from the folder, cleared the build directory, reextracted and then re-ran with _sudo make install_. Still, no dice. As you can see at [REDACTED], I was able to install the other extension, sqlsrv.so, without issue. There must be some sort of incompatibility with Litespeed's flavor of PHP.
@hifihedgehog
Please check our documentation re the steps for enabling the pdo_sqlsrv in Red Hat or CentOS
When you run php --ini, you should see the path to "Scan for additional .ini files in"
I believe the path should be /usr/local/lsws/lsphp73/etc/php.d/
In your case, you can see these entries listed, please do the same for pdo_sqlsrv
/usr/local/lsws/lsphp73/etc/php.d/20-odbc.ini, /usr/local/lsws/lsphp73/etc/php.d/20-pdo.ini,
...
/usr/local/lsws/lsphp73/etc/php.d/30-mysqli.ini, /usr/local/lsws/lsphp73/etc/php.d/30-pdo_mysql.ini, /usr/local/lsws/lsphp73/etc/php.d/30-pdo_odbc.ini, /usr/local/lsws/lsphp73/etc/php.d/30-pdo_pgsql.ini,
The idea is to make sure pdo_sqlsrv is loaded after pdo, so you need to write this line extension=pdo_sqlsrv.so in a file called 30-pdo_sqlsrv.ini
Then put 30-pdo_sqlsrv.ini in /usr/local/lsws/lsphp73/etc/php.d/
The idea is to make sure pdo_sqlsrv is loaded after pdo, so you need to write this line
extension=pdo_sqlsrv.soin a file called30-pdo_sqlsrv.ini
Done. And fixed. Thank you.