다음 스크립트를 실행하려고 할 때
$host = "ip here";
exec("/bin/ping -c2 -w2 $host", $outcome, $status);
return print_r($outcome);
나는 다음과 같은 결과를 본다
Array () 1
왜 이런 일이 일어날 수 있는지에 대한 아이디어가 있습니까? 아무 소용이없는 ping
대신 노력 했어/bin/ping
최신 정보
SSH에서 직접 실행할 때 올바른 응답이 표시되므로 다음과 같습니다.
PING ip here 56(84) bytes of data.
64 bytes from ip here : icmp_seq=1 ttl=243 time=4.47 ms
64 bytes from ip here : icmp_seq=2 ttl=243 time=4.40 ms
--- ip here ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1005ms
rtt min/avg/max/mdev = 4.406/4.438/4.470/0.032 ms
"2> & 1"을 추가하여 std_err을 std_out으로 리디렉션하고 도움이되는 내용이 있는지 확인하십시오.
exec("/bin/ping -c2 -w2 $host 2>&1", $outcome, $status);
구성 안전 모드에 따라 특정 디렉토리에서만 항목을 실행하거나 전혀 실행할 수 없습니다.
여기를보십시오 : php.net/function.exec
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다