我收到了这些错误:
PHP致命错误:main()[function.require]:无法打开所需的'/usr/share/pear/Mail.php'(include_path ='。:/ var / www / vhosts / xxx.net / httpdocs /保护/模块/ rbam /型号:/var/www/vhosts/xxx.net/httpdocs/protected/extensions/translations/components:/var/www/vhosts/xxx.net/httpdocs/protected/extensions/runactions/components: / var / www / www / vhosts中的/var/www/vhosts/xxx.net/httpdocs/protected/components:/var/www/vhosts/xxx.net/httpdocs/protected/models:/usr/share/pear:')第70行的/xxx.net/httpdocs/protected/components/MailComponent.php
首先,include语句不在我的MailComponent.php
的第70行,它在第3行(但是MailComponent.php
正好有69行,所以这可能只是PHP中的错误报告错误)
require_once '/usr/share/pear/Mail.php';
文件/usr/share/pear/Mail.php
就在那里,在/usr/share/pear/Mail.php
,它属于root,但它对每个人都有读取权限;正如您在include路径中看到的那样/usr/share/pear
IS。而且,这种情况直到最近才开始起作用,我还没碰过它。
那么可能是什么问题?!?!?
编辑:我认为这与包含文件所在的文件夹位于httpdocs folder
之外的事实有关,但为什么会这样,我该如何允许呢?
(我也对main()
感到困惑,我在任何地方都没有这样的方法;我正在使用Yii,这里有几个main()
方法(只是grepped) )虽然报告错误在我的代码中,据称在我的MailComponent.php
中,include_once是。)
<?php
require_once '/usr/share/pear/Mail.php'; // PEAR Mail
require_once '/usr/share/pear/Mail/mime.php'; // PEAR Mail_mime
class MailComponent extends CApplicationComponent {
public $defaultHeaders=array();
public $debugUsers=false;
public $debugAdmins=false;
public $debugEmail='matteosistisette@gmail.com';
public $backend='mail';
public function sendMail($address, $subject, $body, $headers=array(), $isadmin=false) {
$actualheaders=array_merge($this->defaultHeaders, $headers);
$actualheaders['Subject']=$subject;
$mail = new Mail_mime(array(
"text_charset" => "utf-8",
"html_charset" => "utf-8",
"eol" => "\n"
));
$mail->setTxtBody($body);
if (($isadmin && $this->debugAdmins) || (!$isadmin && $this->debugUsers)) {
$address=str_replace('@','_AT_',$address)." <".$this->debugEmail.">";
//$address=$this->debugEmail;
}
$actualheaders['To']=$address;
$headersencoded=array();
foreach ($actualheaders as $header=>$value) {
$headersencoded[$header]=$mail->encodeHeader($header, $value, "utf-8", "quoted-printable");
}
//$to=$mail->encodeHeader('To',$address,"utf-8", "quoted-printable");
$to=$headersencoded['To'];
$msg=@$mail->get();
$actualheaders=$mail->headers($headersencoded);
@$factory=& Mail::factory($this->backend);
@$ret=$factory->send($to,$actualheaders,$msg);
if ($ret instanceof PEAR_Error) Yii::log('ERROR SENDING MAIL TO '.$to, 'error');
return $ret;
}
public function notifyAdmins($role, $area, $subjectcode, $bodycode, $params=array()) {
$admins=Yii::app()->authManager->getUsers($role);
$users=array();
foreach ($admins as $userid) {
$user=User::model()->findByPk($userid);
if ($user===null) continue;
if ($user->current_area_id!=$area->id) continue;
if ($user->email===null || ($email=trim($user->email))=='') continue;
$lang=$user->preferredLanguage;
$params['{CHANNEL_NAME}']=I::tattr($area->partialRoot, 'menu.home', $lang);
$params['{USER}']=$user->getActualDisplayName();
$subject=I::t($subjectcode,$lang,$params);
$body=I::t($bodycode,$lang,$params);
$this->sendMail($email, $subject, $body, array(), true);
}
}
}
?>
答案 0 :(得分:0)
您确定正在加载文件“MailComponent.php”的正确版本吗?如果,如你所说,这个文件有69行,并且错误出现在第70行,我首先怀疑错误是指其他一些MailComponent.php文件。