2013-07-29 4 views
0

Windows Server 2008 R2에 Apache2를 설치하고 PHP 모듈을로드했습니다. 내가 중 아파치의 잘못을 구성한 생각 나는 내 CMS (MODX)로로드이 오류 메시지가Apache/PHP - curl 모듈이 제대로 실행되지 않았습니다.

$ch = curl_init('https://itunes.apple.com/us/rss/toppaidapplications/genre=36/limit=15/json'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_NOSIGNAL, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 200000); 
$string = curl_exec($ch); 
curl_close($ch); 

$arr = json_decode($string,true); 
foreach($arr['feed']['entry'] as $val) 
{ 
$var = $val['link']['0']['attributes']['href']; 
echo $var; 
} 

Warning: Invalid argument supplied for foreach() in C:\webserver\www\site1\core\cache\includes\elements\modsnippet\4.include.cache.php on line 15 

: 나는 PHP 스크립트 다음 실행하고자하는 아파치 .conf 또는 php.ini에서 스크립트가 정상적으로 실행되고있는 다른 웹 서버에 설정되어 있지 않습니다.

은 phpinfo는 컬은 (PHP 버전 5.2.18) 스크립트 내가 이전 PHP 버전 (PHP 버전 5.2.17)을 실행하고 실행중인 웹 서버에

curl 
cURL support enabled 
cURL Information 7.30.0 
Age  3 
Features 
AsynchDNS Yes 
Debug No 
GSS-Negotiate Yes 
IDN  No 
IPv6 Yes 
Largefile Yes 
NTLM Yes 
SPNEGO Yes 
SSL  Yes 
SSPI Yes 
krb4 No 
libz Yes 
CharConv No 
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp 
Host i386-pc-win32 
SSL Version  OpenSSL/0.9.8y 
ZLib Version 1.2.7 
libSSH Version libssh2/1.4.2 

를 사용할 수 있는지 알려줍니다. 다음의 phpinfo SAIS : 내 php.ini 파일에서

curl 
cURL support enabled 
cURL Information libcurl/7.24.0 OpenSSL/1.0.0i zlib/1.2.5 

가 writen있는

extension="c:\webserver\php\ext\php_curl.dll" 

답변

0

스크립트에 다음을 추가하여 해결 php_curl.dll를 가리키는 다음

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 

솔루션은 발견 여기 : PHP Curl does not work on localhost?

관련 문제