php 에서 fopen 이 안되고 있는데 원인을 모르겠습니다. (WP RSS 불가)
안녕하세요?
Ubuntu 에 Apache를 설치하고 PHP 를 운영하고 있습니다.
(phpinfo.php : PHP Version 5.2.6-3ubuntu4.1)
Wordpress 를 설치하고 다른부분은 다 잘되는데 RSS 쪽이 문제가 있어서 나온 에러메시지로
------------------------------
RSS 에러: WP HTTP Error: http://planet.wordpress.org/feed/를 위한 fopen 핸들을 열 수 없습니다.
------------------------------
라는 메시지가 대시보드에서 뜨길래 간단한 테스트를 수행해 보았습니다.
<?php $file = fopen ("http://www.php.net/", "r"); if (!$file) { echo "<p>Unable to open remote file.\n"; exit; } while (!feof ($file)) { $line = fgets ($file, 1024); /* This only works if the title and its tags are on one line */ if (preg_match ("@\<title\>(.*)\</title\>@i", $line, $out)) { $title = $out[1]; break; } } fclose($file); ?>
를 fopentest.php 를 수행해 보았는데 결과가
------------------------------
Warning: fopen(http://www.php.net/) [function.fopen]: failed to open stream: Connection timed out in /var/www/fopentest.php on line 2
Unable to open remote file.
------------------------------
처럼 나왔습니다.
콘솔에서 wget http://www.php.net/ 을 입력하니
------------------------------
root@dynamic:/var/www# wget http://www.php.net
--2009-08-18 09:34:56-- http://www.php.net/
접속 168.219.61.250:8080... 접속됨.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html.1'
[ <=> ] 40,541 36.7K/s in 1.1s
2009-08-18 09:34:59 (36.7 KB/s) - `index.html.1' saved [40541]
------------------------------
처럼 나오는걸 봐서는 접속이 괜찮은것 같긴한데..
그리고 /etc/php5/apache2/php.ini 파일 안에 allow_xx 관련 옵션도 On 시킨 상태에서 테스트 해 보았으나 상황은 동일하였습니다.
------------------------------
Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen On On
allow_url_include On On
always_populate_raw_post_data Off Off
------------------------------
회사에서 proxy 를 운영중에 있어서 해당 주소를 콘솔 export http_proxy = http://168.219.61.250:8080 를 해주었습니다.
제 느낌에는 Apache 가 proxy를 통과하지 못하는 느낌인데 관련 처리를 할 수 있는 방법이 있을까요? ㅠ_ㅠ
PHP + Proxy
http://kr.php.net/manual/en/function.fopen.php#47224
위 페이지를 참고하시면 될 것 같습니다.
댓글 달기