Pear mail not working, throwing 500 internal server error

Post everything else here

Moderators: Website/Forum Admins, Other/Off Topic Moderators

pfanning
Posts: 2
Joined: Mon Jun 11, 2012 7:21 am

Pear mail not working, throwing 500 internal server error

Postby pfanning » Mon Jun 11, 2012 9:48 am

Was having the same problem with mime.php. But I moved mime.php from the php folder on the root directory, into a folder on the public_html directory and now mime.php no longer causes a 500 internal server error. However, the same is not true for Mail.php. Moving it to public_html does not solve the problem as it still gives a 500 internal server error. I don't see how the problem can be path related since I am sure of that path and it works for mime.php. All the same, I would greatly appreciate input to point me in the right direction.

Code: Select all

<?


require_once('includes/mime.php'); <-- this line works...
require_once('includes/Mail.php'); <-- ...this line not so much

//include('.:/usr/lib64/php:/usr/lib/php:/usr/share/pear');

 $upload_folder = "res_upload/";

//Get the uploaded file information
$name_of_uploaded_file =
    basename($_FILES['uploaded_file']['name']);
//get the file extension of the file
$type_of_uploaded_file =
    substr($name_of_uploaded_file,
    strrpos($name_of_uploaded_file, '.') + 1);
$size_of_uploaded_file =
    $_FILES["uploaded_file"]["size"]/1024;//size in KBs
	
//Settings
$max_allowed_file_size = 100; // size in KB
//Validations
if($size_of_uploaded_file > $max_allowed_file_size )
{
  $errors .= "\n Size of file should be less than $max_allowed_file_size KB";
} 
 

 
//copy the temp. uploaded file to uploads folder
$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
if(is_uploaded_file($tmp_path))
{
  if(!copy($tmp_path,$path_of_uploaded_file))
  {
    $errors .= '\n error while copying the uploaded file';
  }
} 
$to = "pfcowboy@gmail.com";
$message = new Mail_mime();
//$message->setTXTBody($text);
//$message->addAttachment($path_of_uploaded_file);
//$body = $message->get();
//$extraheaders = array("From"=>$from, "Subject"=>$subject,"Reply-To"=>$visitor_email);
//$headers = $message->headers($extraheaders);
//$mail = Mail::factory("mail");
//$mail->send($to, $headers, $body);

/* echo "file: ".$name_of_uploaded_file;
echo "<br />".print_r($_FILES);
echo "<br />file size: ".$size_of_uploaded_file; */
echo "<br />end of file";

?>

The error message in the error file on the server reads:

[10-Jun-2012 19:58:43] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '../php/mail/mime.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear:/home7/cbceduca/php') in /home7/cbceduca/public_html/employee_job_submission_processor.php on line 9

I'm confident the path is correct yet I cannot open the file. I've set permissions to 0777 on the folder too. Any ideas where I might be going wrong would be warmly received.
User avatar
munky
Site Admin
Posts: 826
Joined: Wed Jul 02, 2003 4:54 pm
Location: Phoenix AZ
Contact:

Re: Pear mail not working, throwing 500 internal server erro

Postby munky » Mon Jun 11, 2012 5:24 pm

looks like Mail.php is looking for mime.php in a different location (you include 'includes/mime.php', while Mail.php includes '../php/mail/mime.php' )
In God we trust,
Everyone else must have an X.509 certificate.

Who is online

Users browsing this forum: No registered users and 7 guests