在 CentOS 系统中,要配置 PHP 的 cURL 扩展,请按照以下步骤操作:
sudo yum install epel-release
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php74
sudo yum update
sudo yum install php-curl
sudo systemctl restart httpd
如果您使用的是 Nginx 和 PHP-FPM,请运行:
sudo systemctl restart nginx
sudo systemctl restart php-fpm
info.php 的文件,其中包含以下内容:<?php
phpinfo();
?>
将此文件放在您的 web 服务器文档根目录中(例如,对于 Apache,默认为 /var/www/html),然后在浏览器中访问 http://your_server_ip/info.php。在显示的 PHP 信息页面中,搜索 “cURL”,如果已启用 cURL 扩展,您应该能看到有关 cURL 的详细信息。
完成上述步骤后,您已成功在 CentOS 中配置了 PHP 的 cURL 扩展。