Programming/PHP2014. 4. 22. 21:35

작년에 보고 관심을 가지고 있었는데...4월 9일날 행사를 했나부다...


Hack Developer Day: April 9, 2014




ZDNet 뉴스자료

http://www.zdnet.co.kr/news/news_view.asp?artice_id=20140421154042&type=xml

 

HHVM : http://hhvm.com/

HackLanguage  http://hacklang.org/

HHVM and Hack Manual : http://docs.hhvm.com/manual/en/index.php


생활 코딩 동영상 설치 강좌!!

http://opentutorials.org/course/692/4542


현재 테스트 되고 있는 오픈소스 리스트  

http://hhvm.com/frameworks/

21개 Frameworks at 100%되었다고함


보니까 codeigniter,laravel,slim 100%로 되어있네요.. 오호~!!


yii는 아직 99.8%로 흠흠....... 아무쪼록 우리나라는 너무 JAVA가 너무 강해서 ㅠㅠ


나도 어쩔 수 없이 JAVA를 요즘 공부하고 있긴하지만........


아무쪼록 PHP가 좀 더 강세를 보일 수 있길 바라며!!!.....

=======================================================================================================


참고로 동영상 youtube 사이트에서 보면 영어 자동자막가능!! 와 좋다!!!...........

그래도 난 어쩔수없이 번역기 돌리면서 봐야되지만 ㅠㅠ...

http://www.youtube.com/watch?v=bjWanTsG22c&list=PLb0IAmt7-GS2fdbb1vVdP8Z8zx1l2L8YS




Posted by 시니^^
Programming/PHP2013. 2. 22. 01:35

1. vi test.sh 에러발생할수있는 쉘스크립트작성

#!/bin/bash
ssssssssss

2. 실행시 에러가 발생함

-------------------------------------------

[root@test]$ /bin/bash test.sh

test.sh: line 3: ssssssssss: command not found
-------------------------------------------
3. PHP에서 exec 실행시 에러 감시 불가
$outmsg = exec('/bin/bash test.sh');
echo $outmsg;
exit;
4. 2>&1 이용한 표준 출력의 전달되는 곳으로 표준에러를 전달
--------------------------------------------
 
2>&1의 의미는 표준 출력의 전달되는 곳으로 표준에러를 전달하라는 의미
0, 1, 2는 각각 표준입력, 표준출력, 표준에러를 의미
--------------------------------------------
$outmsg = exec("/bin/bash test.sh 2>&1", $out, $err);
var_dump($out);
var_dump($err);
exit;
--결과물------------------------------------

array(2) {

  [0]=>  string(3) "111"

  [1]=>  string(46) "test.sh: line 3: ssssssssss: command not found"

}

int(127)

--------------------------------------------


5.  proc_open 사용

$sDesc = array(
        0 => array("pipe", "r"),  // stdin
        1 => array("pipe", "w"),  // stdout
        2 => array("pipe", "w")   //stderr
);
$oProcess = proc_open('/bin/bash test.sh', $sDesc, $aPipes, dirname(__FILE__), null);
if ( is_resource($oProcess) ) {
    $sStdout = stream_get_contents($aPipes[1]);
    $sStderr = stream_get_contents($aPipes[2]);
    fclose($aPipes[1]);
    fclose($aPipes[2]);
    echo 'stdout : '.$sStdout;
    echo 'stderr : '.$sStderr;
    proc_close($oProcess);
} else {
    exit('ERROR');
}

--결과물------------------------------------

stdout : 

stderr : /bin/bash: test.sh: No such file or directory 

--------------------------------------------


참고사이트

http://stackoverflow.com/questions/2320608/php-stderr-after-exec

http://kr.php.net/manual/en/function.proc-open.php 


Posted by 시니^^
Programming/PHP2013. 2. 22. 01:06

수정 작업을 해야되서 페이지 따로 구성해서 작업하는데..

기존 PHP소스에서 잘되던 exec명령어가 안된다......

-------------------------------------------

Warning: exec() has been disabled for security reasons....

-------------------------------------------


위의 에러의 경우 아래의 설정으로 기본적으로 해결된다....

-------------------------------------------

http://www.php.net/manual/kr/ini.sect.safe-mode.php

safe_mode boolean

PHP의 안전 모드 활성화 여부. PHP가 --enable-safe-mode로 컴파일 되면 기본값 On, 아니면 Off.

safe_mode_exec_dir string

PHP가 안전 모드를 사용중이라면, system()과 그 외의 시스템 프로그램을 실행하는 함수는 이 디렉토리에 있지 않으면 프로그램 시작이 거부된다. 윈도우를 포함한 모든 환경에서 디렉토리 구분은 /를 이용해야 합니다.


http://www.php.net/manual/kr/ini.core.php#ini.disable-functions

disable_function 설정

-------------------------------------------


하지만 php.ini아무리 봐도 답이 없음....

확인 결과 해당서버에 뭔가 깔려있다.......

-------------------------------------------

PHP 5.1.6 (cli) 

Copyright (c) 1997-2006 The PHP Group

Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies

    with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

-------------------------------------------

 


수호신(Suhosin) 설치되어있듬(수호신에 대해서 자세한 내용은 다음에 기회있을때 다시...)

우선 아래 실행해보면


if (extension_loaded('suhosin')) {
        $suhosin = @ini_get("suhosin.executor.func.blacklist");
        print_r($suhosin);
}
-------------------------------------------

[root@test]$ php test.php 

system,passthru,shell_exec,exec,show_source,popen,allow_url_fopen,proc_open

-------------------------------------------


시스템 명령어 막아 놓음......

그리고 vhost에서.....

특정 디렉토리만 해당 수호신에 해당 옵션을 별도록 설정 

-------------------------------------------

<Directory ?????/www/???>

php_admin_value suhosin.executor.func.blacklist system,passthru,shell_exec,show_source,popen,allow_url_fopen,popen,proc_open

</Directory>

-------------------------------------------


vhost php_admin_value에 exec가 빠져있기 때문에 허용 되었던 것임....

안되는 원인 찾는다고 계속 삽질했네 휴.....

ㅠ_________ㅠ;;



Posted by 시니^^