如何使用 PHP 7 安装 ext-curl 扩展?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33775897/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I install the ext-curl extension with PHP 7?
提问by Stephan Vierkant
I've installed PHP 7 using this repo, but when I try to run composer install
, it's giving this error:
我已经使用这个 repo安装了 PHP 7 ,但是当我尝试运行时composer install
,它给出了这个错误:
- [package] requires ext-curl * -> the requested PHP extension curl is missing from your system.
- [package] requires ext-curl * -> 您的系统中缺少请求的 PHP 扩展 curl。
With PHP 5, you can easily install it by running the yum
or apt-get install php5-curl
command, but I can't find how to install the PHP 7 equivalent.
使用 PHP 5,您可以通过运行yum
orapt-get install php5-curl
命令轻松安装它,但我找不到如何安装 PHP 7 等效项。
How do I install ext-curl for PHP 7?
如何为 PHP 7 安装 ext-curl?
回答by Sabeeh Chaudhry
Well I was able to install it by :
好吧,我能够通过以下方式安装它:
sudo apt-get install php-curl
on my system. This will install a dependency package, which depends on the default php version.
在我的系统上。这将安装一个依赖包,它依赖于默认的 php 版本。
After that restart apache
之后重启apache
sudo service apache2 restart
回答by jk2K
please try
请尝试
sudo apt-get install php7.0-curl
回答by Bijaya Kumar Oli
If "sudo apt-get install php-curl" command doesnt work and display error We should run this code before install curl.
如果“sudo apt-get install php-curl”命令不起作用并显示错误我们应该在安装 curl 之前运行此代码。
- step1 - sudo add-apt-repository ppa:ondrej/php
- step2 - sudo apt-get update
- step3 - sudo apt-get install php-curl
- step4 - sudo service apache2 restart
- 步骤 1 - sudo add-apt-repository ppa:ondrej/php
- 步骤 2 - sudo apt-get 更新
- 步骤 3 - sudo apt-get install php-curl
- 步骤 4 - sudo 服务 apache2 重启
回答by Excellent Lawrence
I tried the above solutions but it didn't work for me, just incase there any other person in the same shoes, this is what I did. I updated apt-get with the following command
我尝试了上述解决方案,但它对我不起作用,只是以防万一有其他人穿着同样的鞋子,这就是我所做的。我使用以下命令更新了 apt-get
sudo add-apt-repository ppa:ondrej/php
this i installed with php curl for the version of php that i was using, mine was
这是我使用 php curl 安装的,用于我使用的 php 版本,我的是
sudo apt-get install php7.1-curl
回答by Narendra Solanki
We can install any PHP7 Extensions which we are needed at the time of install Magento just use related command which you get error at the time of installin Magento
我们可以安装任何我们在安装 Magento 时需要的 PHP7 扩展,只需使用在 Magento 安装时出现错误的相关命令
sudo apt-get install php7.0-curl
sudo apt-get install php7.0-dom
sudo apt-get install php7.0-mcrypt
sudo apt-get install php7.0-simplexml
sudo apt-get install php7.0-spl
sudo apt-get install php7.0-xsl
sudo apt-get install php7.0-intl
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-ctype
sudo apt-get install php7.0-hash
sudo apt-get install php7.0-openssl
sudo apt-get install php7.0-zip
sudo apt-get install php7.0-xmlwriter
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-iconv
Thanks! Hope this will help you
谢谢!希望能帮到你
回答by Varun P V
First Login to your server and check the PHP version which is installed on your server.
首先登录到您的服务器并检查您的服务器上安装的 PHP 版本。
And then run the following commands:
然后运行以下命令:
sudo apt-get install php7.2-curl
sudo service apache2 restart
Replace the PHP version ( php7.2 ), with your PHP version.
将 PHP 版本 ( php7.2 ) 替换为您的 PHP 版本。
回答by Joyal
If you are using PHP7.1 ( try php -version
to find your PHP version)
如果您使用的是 PHP7.1(尝试php -version
查找您的 PHP 版本)
sudo apt-get install php7.1-curl
then restart apache
然后重启apache
sudo service apache2 restart
回答by CiaranSynnott
install php70w-common.
安装php70w-common。
It provides php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib.
它提供了php-api、php-bz2、php-calendar、php-ctype、php-curl、php-date、php-exif、php-fileinfo、php-filter、php-ftp、php-gettext、php-gmp、 php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop、php-simplexml、php-sockets、php-spl、php-tokenizer、php-zend-abi、php-zip、php-zlib。
回答by SharpC
I got an error that the CURL extension was missing whilst installing WebMail Lite 8on WAMP(so on Windows).
在WAMP上安装WebMail Lite 8 时,我收到一个错误,提示缺少 CURL 扩展(在 Windows上也是如此)。
After reading that libeay32.dll
was requiredwhich was only present in some of the PHP installation folders (such as 7.1.26), I switched the PHP version in use from 7.2.14 to 7.1.26 in the WAMP PHP version menu, and the error went away.
之后读取libeay32.dll
被要求这是只有在一些PHP安装文件夹(如26年7月1日)的存在,我在WAMP PHP版本菜单切换使用的PHP版本7.2.14,从26年7月1日至,错误去离开。
回答by Jakub Ujvvary
If You have 404 or errors while sudo apt-get install php-curl
just try
如果您在sudo apt-get install php-curl
尝试时遇到 404 或错误
sudo apt-get update
and again try
再试一次
sudo apt-get install php-curl
But notice what version was installed (i use php7.3 and php7.4-curl was installed - so it will not work)
但请注意安装的是哪个版本(我使用 php7.3 并安装了 php7.4-curl - 所以它不起作用)
try then
那就试试
sudo apt-get install php7.3-curl
At the end You may want to restart services like: apache2 or php-fpm:
最后,您可能需要重新启动服务,例如:apache2 或 php-fpm:
sudo apache2 restart
sudo service php7.3-fpm restart
this worked for me.
这对我有用。
Check if curl is on the installed modules list for current php:
检查 curl 是否在当前 php 的已安装模块列表中:
php -m