2930 번 글의 답장글: Re: php 관련 질문 드립니다. |
글쓴이: 산이
[홈페이지]
|
글쓴날: 2012년 04월 28일 00:35:26 토(새벽) |
조회: 1681 |
1 KB(1,165 Bytes)
|
파일명: download.php.txt
|
아마 5.2 에서 5.3 으로 넘어오면서 에러메시지 출력부분 설정이
조금 안된것 같네요.
(error_reporting)
1. eregi() 함수는 5.3 에서 사용은 가능하나 향후에 없어질거라고
메시지를 뿌려집니다.
따라서 eregi 함수 대신 preg_match() 함수를 써야 합니다.
2. curl 모듈이 올라와 있는지 체크
shell> php -m
PHP 5.3 의 yum 에는 curl 모듈이 없는것 같네요.
수동으로 설치가 가능하지만 조금 복잡합니다.
같은 버전 php 소스를 받아서 압축을 풀고
yum -y curl-devel
./configure --disable-all --with-curl=shared
make
ls -al modules/curl.so
curl.so 가 만들어졌으면 php.ini 파일에서 extension_dir 로 설정된
디렉토리에
curl.so 를 복사하고 extension = curl.so 추가
그리고 php -m 으로 curl 이 모듈이 올라오면
apachectl restart
3. filesize() 함수를 사용하는 header() 라인은 주석처리
첨부파일 받아서 테스트해보세요.
[고승범]님이 남기신 글:
>-----------------------------------------
>답변자가 기본적으로 참고할 내용입니다.
>- 배포판(옵션) :
>- 커널버전(옵션)
:
>- 데몬버전(예:apache
1.3.27) :
>- 데몬설치유형(RPM/컴파일/기타)
:
>-----------------------------------------
>*스팸필터링:한글
11자 이상 없으면 스팸페이지로 이동합니다.
>
>기존 웹서버를 버전업을 하여 신규 웹서버를 구성하였습니다.
>
>신규 웹 서버에서 다른 부분은 모두 정상 작동하고 있는데
php에서 파일 다운로드 창을 띠우고 파일 다운로드 시 파일이
0바이트로 다운로드 됩니다.
>
>어떤 부분을 확인해바야 하는 지 조언 부탁드리겠습니다.
>==============================================
>OLD Server
>OS : centos5.6
>apache : Apache/2.2.22 (Unix)
>php : PHP 5.2.17 (cli)
>설치방법 : 컴파일
>
>New Server
>OS : centos6.2
>apache : Apache/2.2.15 (Unix)
>php : PHP 5.3.3 (cli)
>설치방법 : yum install
>
>download.php
><?
>
> if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0)",
$_SERVER["HTTP_USER_AGENT"]) && !eregi("(Opera|Netscape)",
$_SERVER["HTTP_USER_AGENT"])) {
> Header("Content-type: audio/mpeg");
> Header("Content-Disposition: attachment;
filename=enjoy.mp3");
> Header("Content-Length:".filesize("http://abc.com/enjoy.mp3"));
> Header("Content-Transfer-Encoding: binary");
> Header("Pragma: no-cache");
> Header("Expires: 0");
> flush();
> } else {
> Header("Content-type: file/unknown");
> Header("Content-Disposition: attachment;
filename=enjoy.mp3");
> Header("Content-Length:".filesize("http://abc.com/enjoy.mp3"));
> Header("Content-Transfer-Encoding: binary");
> Header("Pragma: no-cache");
> Header("Expires: 0");
> flush();
> }
>
> $ch = curl_init();
> curl_setopt( $ch, CURLOPT_URL, "http://abc.com/enjoy.mp3" );
> curl_setopt( $ch, CURLOPT_HEADER, false );
> curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
> curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5 );
> curl_setopt( $ch, CURLOPT_TIMEOUT, 5 );
>
> print curl_exec( $ch );
>?>
========================================
|
이전글 : php 관련 질문 드립니다.
다음글 : Re: Re: php 관련 질문 드립니다.
|
from 211.212.225.115
JS(Redhands)Board 0.4 +@
|
|