PHP 无法加载 php_curl.dll 扩展 [英] PHP unable to load php_curl.dll extension

查看:24
本文介绍了PHP 无法加载 php_curl.dll 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跟进我昨天的帖子(使用 PHP 启用 cURL)

问题是 PHP 无法加载 php_curl.dll.我尝试了几个步骤,包括取消注释 extension=php_curl.dll,确保依赖项 libeay32.dllssleay32.dll eixst 在路径中,重新下载php_curl.dll,替换旧的,最后将文件复制到我的System32文件夹中.

The problem is that PHP isn't able to load php_curl.dll. I've tried several steps including uncommenting extension=php_curl.dll, making sure the dependencies libeay32.dll and ssleay32.dll eixst in the path, re-downloading php_curl.dll, replacing the old one, and lastly copying the file into my System32 folder.

我使用的是 Apache 2.2 和 PHP 5.4.14.我使用它们的单独软件包安装了它们;我没有使用 XAMP 或 WAMP.我使用的是 64 位 Windows 7.

I'm using Apache 2.2 and PHP 5.4.14. I installed both using their individual packages; I'm not using XAMP or WAMP. I'm using Windows 7 64-bit.

如有任何帮助,我们将不胜感激.

Any help at all would be appreciated.

推荐答案

libeay32.dllssleay32.dll 必须是 php_curl 的路径可访问的.dll 加载成功.

libeay32.dll and ssleay32.dll have to be path-accessible for php_curl.dll loading to succeed.

但是将它们复制到 Apache 的 ServerRoot、Apache 的 in、Window 的 System32 中,或者更糟的是复制到 Windows 主目录中一个糟糕的黑客,甚至可能不适用于较新的 PHP 版本.

But copying them into Apache's ServerRoot, Apache's in, Window's System32, or even worse into the Windows main directory is a bad hack and may not even work with newer PHP versions.

正确的做法是将 PHP 路径添加到 Windows Path 变量中.

The right way to do it is to add the PHP path to the Windows Path variable.

  1. 控制面板->系统点击高级系统设置或按WIN+R并输入SystemPropertiesAdvanced
  2. 点击按钮环境变量.
  3. 系统变量下,您会找到Path变量.编辑它并在它前面加上 C:PHP; - 或者你的 PHP 文件夹的任何路径.
    (提示:如果您的 PHP 文件夹包含像 C:Program FilesPHP 这样的空格,您可能需要在此处使用短文件名形式,即 C:Progra~1PHP>.)
  4. 然后完全停止 Apache 并再次启动它(简单的重启可能还不够).
  1. In Control Panel -> System click on Advanced System Settings or press WIN+R and type SystemPropertiesAdvanced
  2. Click the button Environment Variables.
  3. Under System Variables you will find the Path variable. Edit it and prepend C:PHP; to it - or whatever the path to your PHP folder is.
    (Hint: If your PHP folder contains spaces like C:Program FilesPHP you may need to use the short filename form here, i.e. C:Progra~1PHP.)
  4. Then fully stop Apache and start it again (a simple restart might not be enough).

2017-05 更新:
我将上面的说明更改为在 Path 变量前添加 PHP 路径,而不是附加.这可确保使用 PHP 路径中的 DLL 而不是系统其他路径中的任何其他(过时)版本.

Update 2017-05:
I changed the instructions above to prepend the Path variable with the PHP path instead of appending to it. This makes sure that the DLLs in the PHP path are used and not any other (outdated) versions in other paths of the system.

2018-04 更新:
如果您已经选择了错误的方式并将任何 PHP DLL 复制到 Apache 或 Windows 路径,那么我强烈建议您再次删除它们!如果不这样做,则在以后尝试更新 PHP 时可能会遇到麻烦.如果新的 PHP 版本带来了这些 DLL 的新版本,但您的旧 DLL 仍然在系统或 Web 服务器路径中徘徊,则可能首先找到这些旧 DLL.这肯定会阻止 PHP 解释器启动.此类错误可能很难理解和解决.因此,最好现在清理并从 Windows 和 Apache 路径中删除任何提到的 DLL(如果您将它们复制到那里).
(感谢@EdmundTam 和@WasimA.在评论中指出了这个问题!)

Update 2018-04:
If you have already chosen the wrong way and copied any of the PHP DLLs to Apache or Windows paths, then I strongly recommend that you remove them again! If you don't, you might get into trouble when you later try to update PHP. If a new PHP version brings new versions of these DLLs, but your old DLLs still linger around in system or webserver paths, these old DLLs might be found first. This will most certainly prevent the PHP interpreter from starting. Such errors can be very hard to understand and resolve. So better clean up now and remove any of the mentioned DLLs from Windows and Apache paths, if you copied them there.
(Thanks to @EdmundTam and @WasimA. for pointing out this problem in the comments!)

2019-10 更新:
提示:要查找这些 DLL 的所有副本并检查您是否将它们放在错误的文件夹中,您可以在 Windows 命令提示符窗口中使用以下命令:

Update 2019-10:
Tip: To find all copies of these DLLs and check whether you might have placed them in the wrong folders, you can use the following commands in a Windows Command Prompt window:

dir c:libeay32.dll /s
dir c:ssleay32.dll /s

请注意,这些命令可能需要一些时间才能完成,因为它们会搜索系统驱动器 C: 的整个目录结构.

Be warned that these commands may take some time to complete as they search through the entire directory structure of your system drive C:.

2020 年 8 月更新:
如果您的 PHP 文件夹包含空格(即 C:Program FilesPHP),您可能需要在第 3 步的 Path 变量中使用短文件名形式(即 C:Progra~1PHP).感谢@onee 的提示!

Update 2020-08:
If your PHP folder contains spaces (i.e. C:Program FilesPHP) you may need to use the short filename form in the Path variable at step 3 (i.e. C:Progra~1PHP). Thanks to @onee for this tip!

这篇关于PHP 无法加载 php_curl.dll 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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