如何在 CentOS 上安装 Curl PHP?

4

我正在尝试通过yum在我的CentOS操作系统上安装curl。 当我检查时,

curl --version

它显示

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

但是当我运行php -m时,仍然没有获取到curl库。

或者

Call to undefined function curl_init()

我已经通过在 extension=php_curl.dll 去掉 ; 来更改 php.ini 文件并重新启动 httpd 服务,但似乎没有起作用。请问有人可以告诉我原因吗?

2个回答

3
根据这篇文章,您需要执行以下步骤:

以root身份登录并运行

yum install curl

安装php-curl

yum install php-curl

1

已安装curl和php-curl,但不起作用?原因可能是:

/etc/php.d/中的“curl.ini”文件可能被禁用(重命名为curl.ini.disabled)。

执行以下操作:

ls /etc/php.d/
mv /etc/php.d/curl.ini.disabled /etc/php.d/curl.ini 
systemctl restart httpd.service

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接