homepage Welcome to WebmasterWorld Guest from 54.205.189.156
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Pear Configuration issue
pfanning




msg:4463754
 2:13 am on Jun 11, 2012 (gmt 0)

I am getting a 500 server error using or trying to use pear mail and mime. The very last line of code below is causing the 500 error - "$message = new mime();". Evidently, the file cannot be found yet I'm confident in the path.


<?

require_once('../php/mail/mime.php');
require_once('../php/Mail.php');


$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 mime();
?>



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.

 

coopster




msg:4464390
 2:28 pm on Jun 12, 2012 (gmt 0)

Welcome to WebmasterWorld!

If the subdirectory mentioned is one level below where your script is running then you would be correct when you state that the path is correct. However, can you confirm that the follow path is indeed correct? Because that is where your code is telling the processor to find the resource:

/home7/cbceduca/php/mail/mime.php

rlange




msg:4464413
 2:59 pm on Jun 12, 2012 (gmt 0)

pfanning wrote:
The very last line of code below is causing the 500 error - "$message = new mime();".

That's not what your error message says.

[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

Keep in mind that Unix and Linux filesystems are case-sensitive. If Mail_mime was installed through PEAR, the directory name should be "Mail", not "mail".

When that's fixed, you'll find that the line you originally thought was the cause for this error is, in fact, also an error. The class name is actually
Mail_mime, not just mime.

[pear.php.net...]

--
Ryan

rocknbil




msg:4464459
 3:57 pm on Jun 12, 2012 (gmt 0)

Instead of this,

require_once('../php/mail/mime.php');
require_once('../php/Mail.php');

try this (for example),

require_once('/usr/local/bin/php/mail/mime.php');
require_once(/usr/local/bin/php/Mail.php');

Includes and requires are file system paths, not URL's/URI's.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved