我在XAMPP环境中开发了一些php页面并且它工作得很好但是当我将它移动到生产服务器(ubuntu 10.04 apache2)时,有两个页面抛出了错误。
我添加了错误报告脚本,这就是我得到的
Warning: require_once(Mail.php): failed to open stream: No such file or directory in /var/www/globalgoal/include/signallogic.php on line 2 Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/globalgoal/include/signallogic.php on line 2
我在ubuntu服务器上安装了PEAR包。
这是实际代码:
<?php
require_once "Mail.php";
function mailing($context, $user) // Email Notification function
{
$w = date('W')-1;
$leader=array();
$con=mysqli_connect("10.9.245.211","root","password","qa");
$sql="SELECT firstname, lastname, access_id FROM user where username = '$user' ";
$result=mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result))
{
$access_id= $row['access_id'];
$firstname= $row['firstname'];
$lastname= $row['lastname'];
}
$name=$firstname . " " . $lastname;// Analyst name
// Get the initiative lead name
$sql="SELECT firstname, lastname, email FROM user where access_id = $access_id and leader=1 ";
$result=mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result))
{
array_push($leader,$row['email']);
}
$leaderemail="";
for($i=0;$i< count($leader);$i++)
{
$leaderemail .=$leader[$i] . " , ";
}
$leaderemail=str_replace(",",">, <",$leaderemail);
$from = xxxx@ddd.com;
$to = abc@azx.com;
$subject = "Weekly Analyst Inputs - Week " . $w ;
$body = "Hi,<br/><br/>Thank you so much for inputting numbers for week " . $w . ".<br/><br/> These numbers were successfully submitted by <b>" . $name . "</b><br/><br/>" . $context ;
$host = "used corp details"; // SMTP server for eBay email
$username = ""; // No Auth
$password = "";
$MIME="1.0";
$type="text/html; charset=iso-8859-1";
// =================No need to modify below===================
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'MIME-VERSION'=>$MIME,
'Content-Type'=>$type
);
$smtp = @Mail::factory('smtp',
array ('host' => $host,
'auth' => false,
'username' => $username,
'password' => $password));
$mail = @$smtp->send($to, $headers, $body);
if (@PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>The input results are successfully sent to the initiative lead analysts.</p>");
答案 0 :(得分:0)
由于某种原因,没有正确看到PEAR包类。检查/usr/share/pear
路径以查看它是否包含该类,还检查该文件夹的权限
答案 1 :(得分:0)
试试这个:
ini_set('display_errors','on');
error_reporting(E_ALL);
这将帮助您找到错误。