我在这里安装了 libcurl:
/usr/local/curl-7.88.1/
我想要编译 php-curl 扩展:
# cd /usr/src/php-8.1.12/ext/curl/
# /usr/local/php81/bin/phpize
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
# ./configure --with-php-config=/usr/local/php81/bin/php-config --with-curl=/usr/local/curl-7.88.1/
...
checking for cURL support... yes, shared
checking for libcurl >= 7.29.0... no
configure: error: Package requirements (libcurl >= 7.29.0) were not met:
No package 'libcurl' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables CURL_CFLAGS
and CURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
我尝试了几种解决方法,包括设置 CFLAGS 和 LDFLAGS,但结果是一样的。
如果我安装yum install libcurl-devel
,它会忽略--with-curl=/usr/local/curl-7.88.1/
并与系统libcurl
(旧版本)一起工作。
答案1
我可以使用以下标志进行编译
export CFLAGS="-std=c99"
export MYCDIR=/usr/local/curl-7.88.1
export CURL_CFLAGS=-I$MYCDIR/include
export CURL_LIBS="-L$MYCDIR/lib -lcurl"