我已经安装了curl:
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
我已经更新了我的php.ini文件,包括(我也试过.so):
extension=php_curl.dll
为了testingcurl是否工作,我创build了一个名为testCurl.php的文件,它包含以下内容:
<?php echo '<pre>'; var_dump(curl_version()); echo '</pre>'; ?>
当我导航到本地/ testCurl.php我得到一个错误:HTTP错误500
下面是错误日志中的一个片段:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/php_curl.dll' - /usr/lib/php5/20090626+lfs/php_curl.dll: cannot op$ PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open sha$ [Sun Dec 25 12:10:17 2011] [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.3 with Suhosin-Patch configured -- resuming normal operations [Sun Dec 25 12:13:46 2011] [error] [client 127.0.0.1] File does not exist: /var/www/css, referer: http://localhost/ [Sun Dec 25 12:13:46 2011] [error] [client 127.0.0.1] File does not exist: /var/www/css, referer: http://localhost/ [Sun Dec 25 12:13:46 2011] [error] [client 127.0.0.1] File does not exist: /var/www/css, referer: http://localhost/ [Sun Dec 25 12:13:46 2011] [error] [client 127.0.0.1] File does not exist: /var/www/css, referer: http://localhost/`
任何人都可以帮助我curl工作?
问题在于原始的testing代码。 我用了一个新的testing文件包含这个和curl现在正在工作:
<?php ## Test if cURL is working ## ## SCRIPT BY WWW.WEBUNE.COM (please do not remove)## echo '<pre>'; var_dump(curl_version()); echo '</pre>'; ?>
当你在Ubuntu / Debian系统上安装curl时,它会自动加载到你的php安装中:
$ cat /etc/php5/conf.d/20-curl.ini ; configuration for php CURL module ; priority=20 extension=curl.so
你不应该做任何事情,除了重新启动你的networking服务器或CGI池,例如:
sudo /etc/init.d/apache2 restart sudo /etc/init.d/php-fpm restart
我并不积极(我是一个支持PHP和RoR开发的SysAd),但是我认为要在PHP-land中使用curl,我必须使用PECL来安装一个模块。
对不起,我没有更多的细节,但至less在6个月前,我们已经迁移到不同的票务系统。