在 php.ini 上启用 curl_exec
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10310193/
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
enable curl_exec on php.ini
提问by Moein Hosseini
I wanna run php script which has got curl on it.
我想运行有 curl 的 php 脚本。
but following functions are disabled by php.ini:
但以下功能被 php.ini 禁用:
exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,show_source
exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,show_source
I have changed following line in php.ini:
我在 php.ini 中更改了以下行:
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,show_source
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,show_source
and run service httpd restartcommand on ssh,but when I run phpinfo()function it will show curl_exec and curl_multi_exec are disabled again.
并在 ssh 上运行service httpd restart命令,但是当我运行phpinfo()函数时,它会显示 curl_exec 和 curl_multi_exec 再次被禁用。
where is the problem and how should I solve it?
问题出在哪里,我应该如何解决?
回答by vchakoshy
The command line php may be using a different ini file to the one loaded up by Apache.
命令行 php 可能使用与 Apache 加载的 ini 文件不同的 ini 文件。
you must be find which php configuration in used. you need to edit current configuration file.
您必须找到使用的 php 配置。您需要编辑当前的配置文件。
$> php -i | grep "Loaded Configuration File"
Loaded Configuration File => /usr/local/lib/php.ini
$> vim /usr/local/lib/php.ini
and remove disabled function. and final step is :
并删除禁用的功能。最后一步是:
/etc/init.d/httpd restart
回答by Aki
Go to the end of php.ini, and find the following line:
转到 php.ini 的末尾,找到以下行:
disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source;
Just edit it like this:
只需像这样编辑它:
disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,parse_ini_file,show_source;
回答by Amit
If you are kloxo user then you can follow these steps to enable curl.
如果您是 kloxo 用户,则可以按照以下步骤启用 curl。
http://www.bloggertale.com/2013/10/22/enable-curl-kloxo/
http://www.bloggertale.com/2013/10/22/enable-curl-kloxo/
or if you are not using kloxo then login with in your root directory then go to
或者,如果您不使用 kloxo,则在您的根目录中登录,然后转到
/etc
/等等
at there you will get php.ini
在那里你会得到 php.ini
As i know that there is 2 lines
据我所知,有 2 行
exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,show_source
mean one is middle of php.ini and then in last one. You have to Remove from both place.
意思是一个是 php.ini 的中间,然后是最后一个。你必须从两个地方删除。
First:- search curl_exec,curl_multi_execand you will get this line in two place just remove it and save the php.ini and then
首先:- 搜索curl_exec,curl_multi_exec,你会在两个地方得到这一行,只需删除它并保存 php.ini 然后
Use this command :- service httpd restart
使用此命令:- service httpd restart
Then create a file
然后创建一个文件
info.php
信息.php
and write this code to get the status of curl
并编写此代码以获取 curl 的状态
<?=phpinfo();?>
At their you will able to see CURL IS ENABLE.
在他们那里,您将能够看到CURL IS ENABLE。
回答by Vimalnath
Just uncomment this line in your php.ini file
只需在 php.ini 文件中取消注释这一行
;extension=php_curl.dll
and restart your server.
并重新启动您的服务器。
回答by Er. Anurag Jain
First of all please check permission for php.ini ,this must be writable. then go to php.ini and find line
首先请检查 php.ini 的权限,这必须是可写的。然后转到 php.ini 并找到行
;extension=php_curl.dll
and remove ;for uncomment it. and then restart your xampp or wamp server. Please try this change and if get any further problem let me know.
并删除;以取消注释。然后重新启动您的 xampp 或 wamp 服务器。请尝试此更改,如果有任何进一步的问题,请告诉我。
thanks.
谢谢。

