±âÁ¸ ¼Ò½º¿¡¼ filesize() ÇÔ¼ö ¶óÀÎÀ» ÁÖ¼®Ã³¸®Çϸé Á¤»óÀûÀ¸·Î ´Ù¿î·ÎµåµÇ¸é
filesize() ÇÔ¼ö¿¡¼ ¿¡·¯°¡ ³´Ù´Â ¶æÀÔ´Ï´Ù.
php.ini ÆÄÀÏ¿¡¼
allow_url_fopen = On
À¸·Î ¼³Á¤µÇ¾î ÀÖ´ÂÁö È®ÀÎÇغ¸¼¼¿ä.
[°í½Â¹ü]´ÔÀÌ ³²±â½Å ±Û:
>´äº¯ Áּż Á¤¸» °¨»çÇÕ´Ï´Ù.
>
>curl ¸ðµâÀº ¿Ã¶ó¿Í ÀÖ¾ú±¸¿ä, 3¹øÀÇ filesize ºÎºÐ ÁÖ¼®Ã³¸® ÇÏ´Ï Á¤»óÀûÀ¸·Î ÆÄÀÏ
´Ù¿î·Îµå°¡ µÇ¾ú½À´Ï´Ù.
>
>php 5.2¿¡¼´Â µÇÁö¸¸ 5.3¿¡¼´Â ÀÛµ¿ÇÏÁö ¾Ê´Â ¿øÀεµ Á» ¾Ë ¼ö ÀÖÀ»±î¿ä?
>
>Âü°íÇÒ¸¸ÇÑ ¸µÅ©¶óµµ ¾Ë·ÁÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.
>
>
>[»êÀÌ]´ÔÀÌ ³²±â½Å ±Û:
>
>>¾Æ¸¶ 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 );
>>>?>
>>
>>========================================
>
>========================================
========================================
|