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

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

 

PHP code


<?php
$fname = "jirak";
$mail_from = "[email protected]";
$header = "Return-Path: <$mail_from>\n";
$header .= "From: $fname <$mail_from>\n";
$to = "[email protected]";
$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

 

 

 

 

About KENNETH 19688 Articles
지락문화예술공작단

Be the first to comment

Leave a Reply

Your email address will not be published.


*


이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.