PHP編譯curl拓展報錯的原因
阿新 • • 發佈:2019-07-06
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
以上我通過phpize安裝curl拓展報的錯誤。
那麼這是什麼原因,有的人說是原始碼錯誤,需要修改,我覺得這個答案正確率非常低,因為我是從官方網站下載下來的原始碼,理論上不會出錯。
那麼是不是自己的curl安裝有問題呢,想想好像也不太可能,因為我當時環境存在了php7.1.7的版本,跑的挺正常的。那麼可能的問題是高版本和現在環境的curl版本不相容,既然有疑問,那麼我們動手試一試。
安裝下最新的curl版本
下載地址:https://curl.haxx.se/download.html
我下載的是curl-7.65.1.tar.gz這個版本,因為它是最新的,我就喜歡最新的版本,只要不是bate版本。
configure安裝
省略編譯程式碼提示若干~~~~~~
此過程正常(如果不正常,那麼需要找原因,這麼不闡述)
然後make && make install
ok 回頭,我們再進入ext/curl 進行安裝,發現可以了。。
在extensions/no-debug-non-zts-xxx下面出現了curl.so檔案。然後新增php.ini 。