Welcome to WebmasterWorld Guest from 54.227.91.72

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Pear Configuration issue

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

New User

joined:June 11, 2012
posts:1
votes: 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.
2:28 pm on June 12, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12537
votes: 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
2:59 pm on June 12, 2012 (gmt 0)

Full Member

5+ Year Member

joined:Mar 22, 2011
posts:339
votes: 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
3:57 pm on June 12, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members