IanTh
asked on
pear php script errors
see my accepted solution
https://www.experts-exchange.com/questions/24329557/php-and-form-for-an-attached-file.html
which was about uploading a file for attachment
that works the file gets uploaded
but my script I is failing with
Warning: include_once(/PEAR/Mail.ph p) [function.include-once]: failed to open stream: No such file or directory in /home/fhlinux198/i/ian.no1 net.co.uk/ user/htdoc s/send-ema il-form.ph p on line 10
Warning: include_once() [function.include]: Failed opening '/PEAR/Mail.php' for inclusion (include_path='.:/usr/shar e/pear-php 5') in /home/fhlinux198/i/ian.no1 net.co.uk/ user/htdoc s/send-ema il-form.ph p on line 10
Warning: include_once(/PEAR/Mail/mi me.php) [function.include-once]: failed to open stream: No such file or directory in /home/fhlinux198/i/ian.no1 net.co.uk/ user/htdoc s/send-ema il-form.ph p on line 11
Warning: include_once() [function.include]: Failed opening '/PEAR/Mail/mime.php' for inclusion (include_path='.:/usr/shar e/pear-php 5') in /home/fhlinux198/i/ian.no1 net.co.uk/ user/htdoc s/send-ema il-form.ph p on line 11
Fatal error: Class 'Mail_mime' not found in /home/fhlinux198/i/ian.no1 net.co.uk/ user/htdoc s/send-ema il-form.ph p on line 85
does that mean pear isn't installed
https://www.experts-exchange.com/questions/24329557/php-and-form-for-an-attached-file.html
which was about uploading a file for attachment
that works the file gets uploaded
but my script I is failing with
Warning: include_once(/PEAR/Mail.ph
Warning: include_once() [function.include]: Failed opening '/PEAR/Mail.php' for inclusion (include_path='.:/usr/shar
Warning: include_once(/PEAR/Mail/mi
Warning: include_once() [function.include]: Failed opening '/PEAR/Mail/mime.php' for inclusion (include_path='.:/usr/shar
Fatal error: Class 'Mail_mime' not found in /home/fhlinux198/i/ian.no1
does that mean pear isn't installed
ASKER
noi still getting the warnings and then fatal error class 'mail_mime' not found
I don't think its installed as its a subdomain of a reseller account at fasthosts
I dont have shell access so I cannot install it
I don't think its installed as its a subdomain of a reseller account at fasthosts
I dont have shell access so I cannot install it
If you donÄt need to use the PEAR installation of your hoster.
Read COMPLETLY http://pear.php.net/manual/en/installation.shared.php special the second topic
Read COMPLETLY http://pear.php.net/manual/en/installation.shared.php special the second topic
ASKER
I dont think I can its a fasthost account and I found out pear is installed because I dit the following
<?php
require_once 'System.php';
var_dump(class_exists('Sys tem'));
require_once 'PEAR.php';
var_dump(class_exists('PEA R'));
phpinfo ();
?>
And I get
bool(true) bool(true)
which means pear is installed
but I found out pear is installed with php
so I did
<?php
/* $path = "/usr/local/bin/pear";
set_include_path(get_inclu de_path() . PATH_SEPARATOR . $path); */
require_once 'System.php';
var_dump(class_exists('Sys tem'));
require_once 'PEAR.php';
var_dump(class_exists('PEA R'));
require_once 'Mail.php';
var_dump(class_exists('Mai l'));
require_once 'Mail/mime.php';
var_dump(class_exists('mim e'));
phpinfo ();
?>
and I get
bool(true) bool(true) bool(false) bool(false)
so how can I fix that
<?php
require_once 'System.php';
var_dump(class_exists('Sys
require_once 'PEAR.php';
var_dump(class_exists('PEA
phpinfo ();
?>
And I get
bool(true) bool(true)
which means pear is installed
but I found out pear is installed with php
so I did
<?php
/* $path = "/usr/local/bin/pear";
set_include_path(get_inclu
require_once 'System.php';
var_dump(class_exists('Sys
require_once 'PEAR.php';
var_dump(class_exists('PEA
require_once 'Mail.php';
var_dump(class_exists('Mai
require_once 'Mail/mime.php';
var_dump(class_exists('mim
phpinfo ();
?>
and I get
bool(true) bool(true) bool(false) bool(false)
so how can I fix that
You can't fix this. PEAR is installed, but not Mail_Mime. You need to put those files/Classes via ssh/ftp/.. to the server in your own directory or use your own PEAR-instllation as descibed in the pear manual
ASKER
why though if pear is installed why do I get a fatal class error on Mail_mime
I have another sendmail script that uses mail() and that works on the server with no problem without include_once
so the path is correct. It just doesn't work with attachments as the fifth element in mail() is set by fasthost to be a username on their servers
mail($emailadd, $subject, $text, "From: $fromadd", "-f".$fromadd );
where normally it would be
mail($emailadd, $subject, $text, "From: $fromadd", $attachment );
I have another sendmail script that uses mail() and that works on the server with no problem without include_once
so the path is correct. It just doesn't work with attachments as the fifth element in mail() is set by fasthost to be a username on their servers
mail($emailadd, $subject, $text, "From: $fromadd", "-f".$fromadd );
where normally it would be
mail($emailadd, $subject, $text, "From: $fromadd", $attachment );
Mail_mie is not part of the default pear installation and also has nothing to do with the php build in function mail. If you need attachemnt use
http://swiftmailer.sf.net or
http://phpmailer.sf.net
http://swiftmailer.sf.net or
http://phpmailer.sf.net
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try
include_once 'Mail.php';
include_once 'Mail/mime.php';
PHP will go through the include_path and try to find Mail.php as
./Mail.php
/usr/share/pear-php5/Mail.