如何安装curl php在centos

7lrncoxx  于 2022-11-07  发布在  PHP
关注(0)|答案(2)|浏览(189)

我试图安装curl到我的centos操作系统由yum当我检查

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()

我修改了文件php.ini,在extension=php_curl.dll处删除了;,并重新启动了httpd服务,但似乎不工作。有人能告诉我吗

mlmc2os5

mlmc2os51#

根据this article,您接下来应该执行:

以root身份登录并运行

yum install curl

正在安装php-curl

yum install php-curl
fxnxkyjh

fxnxkyjh2#

安装了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

相关问题