만약 파일 업로드에서 


file_uploads On

post_max_size

max_execution_time

memory_limit

max_file_uploads

upload_max_filesize

위에 사항을 업로드 하려는 파일의 사이즈보다 크게 그리고 다른 사항들도 모두 정상적으로 설정했는데 파일이 업로드 되지 않는다면

/tmp overflow의 size를 확인해 보자



/tmp가 overflow 되었다고 나오는 부분이 보일 것이다.


이럴때 다음과 같이 하면 된다.


sudo umount -l /tmp
sudo mount -t tmpfs -o size=10485760,mode=1777 overflow /tmp


exec 나 shell_exec 를 비동기로 처리해야할 때가 있다. 그때는 명령어 뒤에 " > /dev/null 2>/dev/null &"를 붙혀주면 된다

exec("실행할 명령" . " > /dev/null 2>/dev/null &")
shell_exec("실행할 명령" . " > /dev/null 2>/dev/null &")


curl로 html 소스 코드를 가져오려고 하는데 

http 302(redirect) 문제로 redirect된 페이지의 소스코드를 가져올 때 다음과 같이 하면 된다.


        $url = "YOUR URL";
        $res = array();
        $options = array( 
            CURLOPT_RETURNTRANSFER => true,     // return web page 
            CURLOPT_HEADER         => false,    // do not return headers 
            CURLOPT_FOLLOWLOCATION => true,     // follow redirects 
            CURLOPT_USERAGENT      => "spider", // who am i 
            CURLOPT_AUTOREFERER    => true,     // set referer on redirect 
            CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect 
            CURLOPT_TIMEOUT        => 120,      // timeout on response 
            CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects 
        ); 

        $ch      = curl_init( $url ); 
        curl_setopt_array( $ch, $options ); 
        $content = curl_exec( $ch ); 
        $err     = curl_errno( $ch ); 
        $errmsg  = curl_error( $ch ); 
        $header  = curl_getinfo( $ch ); 
        curl_close( $ch ); 

        echo $content

+ Recent posts