2013-07-18 40 views
0

我在XAMPP环境下开发了一些PHP页面,它工作完美,但是当我将它移动到生产服务器(ubuntu 10.04 apache2)时,有两个页面抛出错误。PHP网站错误500

我添加了错误报告的脚本,这是我得到

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 = [email protected]; 
    $to = [email protected]; 

    $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>"); 
+2

您是否检查过您包含的或在代码中使用的所有文件是否正确?请记住,Windows是**不区分大小写,而Ubuntu是。 'Mail.php'与'mail.php'不同。启用错误报告将是有益的,如果你只是得到错误500 – 3ventic

+0

错误几乎不言自明 - 看'Mail.php'是否在'/ var/www/globalgoal/include'中。 – moonwave99

+0

我现在可以看到页面,但邮件功能不起作用。 – sai

回答

0

出于某种原因,PEAR包类是没有看到correctly.Check的/usr/share/pear路径,看它是否包含了类,还要检查该文件夹的权限

+0

没有名为usr/share/pear的文件夹 – sai

+0

除邮件功能和最差的部分外,我没有看到任何错误。 – sai

0

试试这个:

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

这将帮助你查找错误。