我写了一个小小的PHP脚本:
<?php
$phpPath = shell_exec("which php");
print "$phpPath\n";
$uid = posix_getuid();
$userinfo = posix_getpwuid($uid);
print_r($userinfo );
print "\n";
$to = "my_user_name@my_company_mail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "do-not-reply@akamai.com";
$headers = "From:" . $from;
$res = mail($to,$subject,$message,$headers);
print_r(error_get_last());
if($res){
echo "Mail Sent.\n";
}else{
echo "Mail was'nt Sent\n";
}
?>
让我疯狂的是,当我从命令行执行这个脚本时,它工作正常:
的/ usr / bin中/ PHP的
阵 ( [name] =&gt;守护进程 [passwd] =&gt; X [uid] =&gt; 1 [gid] =&gt; 1 [gecos] =&gt;守护进程 [dir] =&gt; / usr / sbin目录 [shell] =&gt; / bin / sh的 )
邮件已发送。
但是当我从远程浏览器执行它时,我得到的是:
的/ usr / bin中/ PHP的
阵 ( [name] =&gt;守护进程 [passwd] =&gt; X [uid] =&gt; 1 [gid] =&gt; 1 [gecos] =&gt;守护进程 [dir] =&gt; / usr / sbin目录 [shell] =&gt; / bin / sh的 )
邮件未发送
任何想法? 提前10x:)
答案 0 :(得分:1)