卷曲的呼叫不工作的Apache / PHP [英] Curl Calls are not working on Apache/PHP

查看:157
本文介绍了卷曲的呼叫不工作的Apache / PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的卷曲通话不被在Apache / PHP启用。我的PHP版本是5.6.3(X32)和Apache 2.4

我已经注释掉,使用C卷曲行:/PHP/php.ini:

 扩展= p​​hp_curl.dll

另外,我已经确定在我的路径变量包括PHP的路径和PHP分机路径,以便既 ssleay32.dll libeay32 .DLL 由PHP文件规定已启用。这里的路径是:

<$p$p><$c$c>C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program文件(x86)\\ ATI技术\\ ATI.ACE \\核心静电; C:\\ PROGRAM Files\\TortoiseSVN\\bin;C:\\PHP;C:\\PHP\\ext;C:\\Apache24\\bin;C:\\xampp\\apache\\bin;C:\\Ruby193\\bin;C:\\xampp\\apache\\bin\"

不过,我仍然得到在日志中此错误无数重新启动后:

  PHP致命错误:调用在C未定义功能curl_init():\\\\ \\\\ Apache24的htdocs \\\\ \\\\用户\\\\ newapi对test.php的5号线,引用者:HTTP ://本地主机/ newapi /


解决方案

我知道这是显而易见的,但首先要检查的地方是PHP配置,确保卷曲没有列之一:

  disable_functions选项=
disable_classes =

在检查PHP的设置,请确保您已经(根据你的路径上):

 的extension_dir =C:\\ PHP \\分机

验证(再次)是C:\\ PHP \\分机\\ php_curl.dll确实存在,它不只是从XAMPP复制安装

在此之后,这取决于你如何启动的Apache(使用系统帐户作为用户服务),您可能需要检查除了系统路径的用户路径。

在一个时间点,我发现我不得不说,正在调用PHP二进制文件引起版本冲突之前ssleay32.dll和的libeay32.dll的多个副本。已经包含了我遇到了下面的麻烦的例子。

要看到正在使用的完整路径(假设的Apache正在从用户空间中运行):

  C:\\&GT;回声%PATH%
C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program文件\\卷曲; C:\\ Program Files文件\\卷曲\\ dll文件; C:\\网络\\ PHP; C:\\ Python27;

在这台机器,这些条目是来自于我的用户路径,而不是系统的路径:

  C:\\ Program Files文件\\卷曲; C:\\ Program Files文件\\卷曲\\ dll文件; C:\\网络\\ PHP; C:\\ Python27;

要检查的路径安装文件的位置:

  C:\\&GT;其中,ssleay32.dll
C:\\ Program Files文件\\卷曲\\ dll文件\\ ssleay32.dll
C:\\网络\\ PHP \\ ssleay32.dll
C:\\&GT;

在这个例子中,我附带的dll文件生成卷曲和PHP都是足够远,他们互不兼容。 PHP试图加载卷曲的dll文件,但没有成功。我没有做安装它,所以我现在不能检查,但TortoiseSVN的可能包括他们。

这大概也是值得证实该文件的权限:

  C:\\&GT; CACLS C:\\网络\\ PHP \\ ssleay32.dll
C:\\网络\\ PHP \\ ssleay32.dll BUILTIN \\管理员:(ID)的F
                        NT AUTHORITY \\ SYSTEM:(ID)的F
                        BUILTIN \\用户:(ID)R
                        NT AUTHORITY \\ Authenticated用户(ID)C

作为一个方面说明,将文件复制到的%SystemDrive%\\ Windows \\ System32下是一个坏主意。它基本上只是一个黑客获取任何文件到系统路径(在优先位置),而无需向用户讲解如何编辑路径变量。

My curl calls are not being enabled on Apache/PHP. My PHP version is 5.6.3 (x32) and Apache is 2.4

I've already uncommented the line that enables curl in C:/PHP/php.ini:

extension=php_curl.dll

Also, I have made sure to include in my path variables both the PHP path and PHP ext path so that both ssleay32.dll and libeay32.dll as specified by the PHP documentation is enabled. Here is the path:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;C:\PHP;C:\PHP\ext;C:\Apache24\bin;C:\xampp\apache\bin;C:\Ruby193\bin;C:\xampp\apache\bin"

However, I still get this error in the log after numerous restarts:

PHP Fatal error:  Call to undefined function curl_init() in C:\\Apache24\\htdocs\\user\\newapi\\test.php on line 5, referer: http://localhost/newapi/

解决方案

I know it's obvious, but the first place to check is the PHP configuration, make sure that curl is NOT listed in either:

disable_functions=
disable_classes=

While checking php settings, make sure that you have (based on your path):

extension_dir="C:\PHP\ext"

Verify (again) that C:\PHP\ext\php_curl.dll actually exists and that it wasn't just copied from the XAMPP install.

After that, depending on how you launch Apache (as a service using the System account or as a user), you may need to check the user path in addition to the system path.

At one point in time, I'd found that I had multiple copies of ssleay32.dll and libeay32.dll that were being called BEFORE the PHP binaries causing a version conflict. I've included an example of the trouble I ran into below.

To see the full path being used (assuming Apache is being run from user space):

C:\> echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\curl;C:\Program Files\curl\dlls;C:\Web\php;C:\Python27;

On this machine, these entries are from my user path and not the system path:

C:\Program Files\curl;C:\Program Files\curl\dlls;C:\Web\php;C:\Python27;

To check the location of installed files in the path:

C:\> where ssleay32.dll
C:\Program Files\curl\dlls\ssleay32.dll
C:\Web\php\ssleay32.dll
C:\> 

In this example, the included dlls for my builds of curl and php were far enough apart that they were incompatible with each other. PHP was trying to load curl's dlls, but failed. I don't have it installed so I can't check right now, but TortoiseSVN may include them.

It would probably also be worth verifying the permissions on the file:

C:\> cacls c:\Web\php\ssleay32.dll
C:\Web\php\ssleay32.dll BUILTIN\Administrators:(ID)F
                        NT AUTHORITY\SYSTEM:(ID)F
                        BUILTIN\Users:(ID)R
                        NT AUTHORITY\Authenticated Users:(ID)C

As a side note, copying files to %SystemDrive%\Windows\System32 is a bad idea. It's basically just a hack to get whatever files into the system path (in a priority position) without having to explain to the user how to edit the path variables.

这篇关于卷曲的呼叫不工作的Apache / PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆