The cause of curl extension error in PHP compilation

Keywords: Programming curl PHP Makefile

For a while, I wanted to install through the source code, and then expand the installation one by one. Many of them are installed smoothly, but curl seems to report an error.

In file included from /usr/local/php7.3/include/php/main/php.h:468:0,
                 from /home/download/php-7.3.7/ext/curl/interface.c:25:
/home/download/php-7.3.7/ext/curl/interface.c: In function 'zm_startup_curl':
/home/download/php-7.3.7/ext/curl/interface.c:1403:25: error: 'CURLAUTH_GSSAPI' undeclared (first use in this function)
  REGISTER_CURL_CONSTANT(CURLAUTH_GSSAPI);
                         ^
/usr/local/php7.3/include/php/Zend/zend_constants.h:53:105: note: in definition of macro 'REGISTER_LONG_CONSTANT'
 #define REGISTER_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number)
                                                                                                         ^
/home/download/php-7.3.7/ext/curl/interface.c:1403:2: note: in expansion of macro 'REGISTER_CURL_CONSTANT'
  REGISTER_CURL_CONSTANT(CURLAUTH_GSSAPI);
  ^
/home/download/php-7.3.7/ext/curl/interface.c:1403:25: note: each undeclared identifier is reported only once for each function it appears in
  REGISTER_CURL_CONSTANT(CURLAUTH_GSSAPI);
                         ^
/usr/local/php7.3/include/php/Zend/zend_constants.h:53:105: note: in definition of macro 'REGISTER_LONG_CONSTANT'
 #define REGISTER_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number)
                                                                                                         ^
/home/download/php-7.3.7/ext/curl/interface.c:1403:2: note: in expansion of macro 'REGISTER_CURL_CONSTANT'
  REGISTER_CURL_CONSTANT(CURLAUTH_GSSAPI);
  ^
Makefile:194: recipe for target 'interface.lo' failed
make: *** [interface.lo] Error 1

The above error I reported by installing curl expansion through phpize.

So what's the reason? Some people say that the source code is wrong and needs to be modified. I think the accuracy rate of this answer is very low, because I download the source code from the official website, and it will not be wrong in theory.

So is there a problem with my curl installation? It's impossible to think about it, because my environment had a version of php7.1.7 at that time. It ran normally. The possible problem is that the higher version is not compatible with the curl version of the current environment. Since there is doubt, let's try it.

Install the latest curl version

Download address: https://curl.haxx.se/download.html

I downloaded curl-7.65.1.tar.gz, because it is the latest version, I like the latest version, as long as it is not the bate version.

configure installation

Some tips for omitting compiled code~~~~~~

This process is normal (if it is abnormal, you need to find out the reason, so don't elaborate)

Then make & & make install

ok, let's go back to ext/curl and install it. We found that it was ok.

The curl.so file appears under extensions/no-debug-non-zts-xxx. Then add php.ini.

Posted by Roja on Sun, 03 Nov 2019 01:05:43 -0700