如何让CURL在Windows上使用PHP? (WAMP) [英] How to get CURL to work with PHP on Windows? (WAMP)
问题描述
更新:问题似乎已经损坏的DLL在我的PHP安装的某个地方,或者可能在PHP 5.2.9在Win2k上的错误。我从php.net下载了PHP 5.2.10的windows(仅二进制文件)分发,并解压到我的c:\PHP目录。
Update: The problem appears to have been corrupt DLLs somewhere in my PHP installation, or possibly a bug in PHP 5.2.9 on Win2k. I downloaded the windows (binaries-only) distribution of PHP 5.2.10 from php.net and extracted that to my c:\PHP directory. After doing that, everything worked fine.
Update2 :我删除了我之前尝试的一切(从下面的项目符号列表中选择), >除了,我留下了 extension = php_curl.dll
取消注释在我的php.ini文件。原来,这是所有你应该做的正确安装。
Update2: I undid everything that I tried earlier (everything from the bulleted list below), except that I left "extension=php_curl.dll
" uncommented in my php.ini file. It turns out that is all you should have to do in a proper installation.
我试图得到CURL工作在PHP的Windows安装(版本5.2.9-2),并且我在结尾。我找到了 PHP CURL安装页面,这个SO问题,其引用此页面和这个SO问题。我已经尝试了所有这些页面中的大部分建议,但我仍然得到一个错误。这是我很简单的测试页:
I'm trying to get CURL to work on a Windows installation of PHP (version 5.2.9-2), and I am at wit's end. I have found the PHP CURL installation page, this SO question which references this page, and this SO question. I've tried most of the suggestions in all of those pages but I still get an error. Here is my very simple test page:
<?php
$ch = curl_init();
?>
<b>Success!</b>
这给我:
致命错误:在 2 行中调用 C:\ApacheRoot\curltest.php 中的未定义函数curl_init
Fatal error: Call to undefined function curl_init() in C:\ApacheRoot\curltest.php on line 2
在我的Apache错误日志中,我每次服务器启动时都会看到:
In my Apache error log I get this each time the server starts:
PHP警告:PHP启动:无法加载动态库'C:\\PHP\\ext\\php_curl.dll' - 指定找不到过程。\r\\\
未知在第0行
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\PHP\\ext\\php_curl.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
以下内容:
- 取消注释php.ini中的以下行:
extension = php_curl.dll
- 从C:<%c $ c>复制
ssleay32.dll
和libeay32.dll
\PHP to C:\WINNT\System32 - 从 curl.haxx.se ,并将.zip文件解压缩到C:\cURL
- 添加了
C:\cURL $
- 验证:
- php.ini包含
extension_dir =C:\PHP\ext
- 目录
C:\PHP\ext
包含php_curl.dll
- 只有
php.ini
文件在我的系统是在C:\PHP
(ie特别是没有C:\WINNT\php.ini
) - Apache
httpd。 conf
文件包含PHPIniDirC:/ PHP /
- Uncommented the following line in php.ini:
extension=php_curl.dll
- Copied
ssleay32.dll
andlibeay32.dll
from C:\PHP to C:\WINNT\System32 - Downloaded cURL for Win32 from curl.haxx.se and extracted the .zip file to C:\cURL
- Added
C:\cURL
to my system PATH environment variable. - Verified that:
- php.ini includes
extension_dir="C:\PHP\ext"
- The directory
C:\PHP\ext
containsphp_curl.dll
- The only
php.ini
file on my system is inC:\PHP
(i.e. especially that there is noC:\WINNT\php.ini
) - The Apache
httpd.conf
file includes the linePHPIniDir "C:/PHP/"
我也重新启动了机器(几次,实际上...)。
I have also rebooted the machine (several times, in fact...).
推荐答案
您不必重新启动计算机,只需重新启动apache,php模块将读取新的ini。
是否更改了正确的php.ini?遇到疑问时You don't have to reboot the computer, just restart the apache and the php module will read the new ini.
Did you change the correct php.ini? In case of doubt<?php echo 'php.ini: ', get_cfg_var('cfg_file_path'); ?>
可以告诉你。
在apache的error.log中有指示加载php和php_curl.dll时发生错误的东西?
Is there something in the error.log of the apache that indicates that something went wrong while loading php and the php_curl.dll?
您作为win32服务启动了apache吗?如果你尝试启动它作为控制台应用程序。错误消息将显示在控制台上。或者将其作为服务启动,并查看error.log文件和 Windows事件日志(start,run,
eventvwr.msc / s
)。Did you start the apache as a win32 service? If you did try to start it as a console application. Error messages will show up on the console then. Or start it as a service and take a look at the error.log file and the windows event log (start, run,
eventvwr.msc /s
).编辑:
无法找到指定的过程
您需要一个兼容的dll与您的PHP版本和构建。您安装的是什么,您从哪里得到它?edit:
"The specified procedure could not be found"
You need a dll that is compatible with your php version and build. Exactly what did you install and where did you get it from?这篇关于如何让CURL在Windows上使用PHP? (WAMP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- php.ini includes
- php.ini包含