컴퓨터/고장해결

php 함수중 file에 관한 질문 입니다...

스노우볼^^ 2008. 11. 29. 20:32

<? 
 $a = file("http://kr.yahoo.com/index.html");
 $cnt = count($a);
 
 echo $cnt;
?>

이렇게 코딩하면 야후메인페이지의 코딩 줄수가 나와야 되는것 같은데

이런 에러만 뜨네요..

 

Warning: file(): URL file-access is disabled in the server configuration in/home/nurimaru0/www/stude/url/a.php on line 2

Warning: file(http://www.naver.com): failed to open stream: no suitable wrapper could be found in/home/nurimaru0/www/stude/url/a.php on line 2
1

 

어서 잘못된것일까요....ㅠ.ㅠ



 

file 함수로 사이트 url 을 지정하실려면 php.ini 파일에서 allow_url_fopen 이 on 으로 되어있어야 합니다.

위 파일은 php.ini 파일입니다.

참고로 저는 php.ini 파일 위치가 /usr/local/apach/conf/php.ini 에 있습니다.

파일에 보시면 allow_url_fopen 이란거 보이시져 그걸 확인해 보시고 off 로 되어있으시면 on 으로 바꾸신후에 apachectl restart 하고 해보세요

 

위에분의 답변을보구 추가로 말씀드리자면

file 함수를 사용하시더라도 서버에서 사용하는 소스를 보이는게 아니라 서버에서 해석한 결과만을 보실수 있습니다.  (html 소스, javascript)