php sqlsrv extension

Hi everyone.

Does anybody know why I am getting this error and how to solve it when running "pecl install sqlsrv":

/bin/sh /var/tmp/pear-build-rootQ3We6Z/sqlsrv-5.1.2preview/libtool --mode=compile g++ -std=c++11 -I. -I/var/tmp/sqlsrv -DPHP_ATOM_INC -I/var/tmp/pear-build-rootQ3We6Z/sqlsrv-5.1.2preview/include -I/var/tmp/pear-build-rootQ3We6Z/sqlsrv-5.1.2preview/main -I/var/tmp/sqlsrv -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/var/tmp/sqlsrv/shared/  -DHAVE_CONFIG_H  -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector   -c /var/tmp/sqlsrv/conn.cpp -o conn.lo
libtool: compile:  g++ -std=c++11 -I. -I/var/tmp/sqlsrv -DPHP_ATOM_INC -I/var/tmp/pear-build-rootQ3We6Z/sqlsrv-5.1.2preview/include -I/var/tmp/pear-build-rootQ3We6Z/sqlsrv-5.1.2preview/main -I/var/tmp/sqlsrv -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/var/tmp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /var/tmp/sqlsrv/conn.cpp  -fPIC -DPIC -o .libs/conn.o
In file included from /usr/include/php/Zend/zend_types.h:27:0,
                 from /usr/include/php/Zend/zend.h:29,
                 from /usr/include/php/main/php.h:35,
                 from /var/tmp/sqlsrv/shared/core_sqlsrv.h:34,
                 from /var/tmp/sqlsrv/php_sqlsrv.h:25,
                 from /var/tmp/sqlsrv/conn.cpp:20:
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)':
/usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
                                                                    ^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_decrement_function(zval*)':
/usr/include/php/Zend/zend_operators.h:500:68: error: '__builtin_ssubl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
                                                                    ^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_add_function(zval*, zval*, zval*)':
/usr/include/php/Zend/zend_operators.h:554:80: error: '__builtin_saddl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
                                                                                ^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_sub_function(zval*, zval*, zval*)':
/usr/include/php/Zend/zend_operators.h:657:80: error: '__builtin_ssubl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
                                                                                ^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
make: *** [conn.lo] Error 1
ERROR: `make' failed

Open in new window

LVL 6
Ludwig DiehlSystems ArchitectAsked:
Who is Participating?
 
Yoshiaki IinumaCommented:
I had the same problem. "pecl install sqlsrv" did not work. But "yum install php-sqlsrv" did.  It installed sqlsrv and pdo_sqlsrv.
2
 
Dave BaldwinFixer of ProblemsCommented:
This page https://github.com/Microsoft/msphpsql links to the downloads and installation instructions for the 'sqlsrv' extension.
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
My guess, reading the link Dave posted, is you're trying to install sqlsrv on a pre-PHP-7.0 server, so PHP-5.6 or below.

Based on the project's docs, you must be using PHP-7.0 or above.

Check your PHP version first. You can do this via phpinfo() call or php --version on the command line.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Ludwig DiehlSystems ArchitectAuthor Commented:
I am using php 7.2. remi repos
0
 
Ludwig DiehlSystems ArchitectAuthor Commented:
Btw I did follow the instructions from ms
0
 
Ludwig DiehlSystems ArchitectAuthor Commented:
I am using Centos 7 so I followed exactly this: https://www.microsoft.com/en-us/sql-server/developer-get-started/php/rhel/
0
 
Ludwig DiehlSystems ArchitectAuthor Commented:
Yes. I also did that. It is weird...
0
 
NerdsOfTechTechnology ScientistCommented:
If that worked for you, I urge the author to give Yoshiaki Linuma the 'best solution' and full points, so that others can benefit from the answer.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.