今天要用到curl函数抓站,php抛出错误:
Fatal error: Call to undefined function curl_init() in D:\wwwroot\Test\test\curl.php on line 2
curl_init函数未定义,
打开php.ini把extension=php_curl.dll前面的分号去掉,重启apache发现还是不行.
查看手册有这么一句话:
Note to Win32 Users: In order to enable this module on a Windows environment, you must copy libeay32.dll and ssleay32.dll from the DLL folder of the PHP/Win32 binary package to the SYSTEM folder of your Windows machine. (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM)
意思是,如果你用的平台是win32的话,要激活curl模块,必须要复制libeay32.dll和ssleay32.dll到你的系统目录里,比如c:\windows\system32目录里.
这二个文件在你下载的php安装包的根目录里,copy到系统目录,重启apache,一切搞定.