Site icon 지락문화예술공작단

[PHP] PHP mail() error (“sh: -t: command not found”)

PHP mail() error (“sh: -t: command not found”)

 

PHP code


<?php
$fname = "jirak";
$mail_from = "master@jirak.net";
$header = "Return-Path: <$mail_from>\n";
$header .= "From: $fname <$mail_from>\n";
$to = "admin@jirak.net";
$subject = "test";
$body = "aaaauhahahaha";
mail($to, $subject, $body, $header, '-f'.$mail_from);
?>

 

exec result


# php mail.php
sh: -t: command not found

 

 

처음 보는 에러라서 흠칫…
대체 -t 는 근거가 뭘까 싶었는데..

php.ini 의 설정과 관련이 있음

 

 

정상(??)서버


# php -i|grep sendmail
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
Path to sendmail => /usr/sbin/sendmail -t -i

 

 

문제의 서버


# php -i|grep sendmail
sendmail_from => no value => no value
sendmail_path => -t -i => -t -i
Path to sendmail => -t -i

앞의 sendmail 이 없으니 발생하는 에러로 보여짐

 

 

해결

php.ini 수정

default


;sendmail_path =

 

변경


sendmail_path = /usr/sbin/sendmail -t -i

 

 

 

 

Exit mobile version