0

我在 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>");
4

2 回答 2

0

由于某种原因,没有正确看到 PEAR 包类/usr/share/pear。检查路径以查看它是否包含该类,还要检查文件夹的权限

于 2013-07-18T20:46:39.607 回答
0

尝试这个:

ini_set('display_errors','on');
error_reporting(E_ALL);

这将帮助您找到错误。

于 2016-08-06T04:53:16.953 回答