If you're getting some sort of 'php unable to load dynamic library' problem in PHP while trying to send email with PEAR/PHP on Ubuntu you'll probably need to do the following to install pear:
sudo apt-get install php-pear
sudo pear install mail
sudo pear install Net_SMTP
sudo pear install Auth_SASL
sudo pear install mail_mime
Getting this error after:-
ReplyDeletepear install mail command
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/IcePHP.so' - /usr/lib/php5/20060613+lfs/IcePHP.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/ffmpeg.so' - /usr/lib/php5/20060613+lfs/ffmpeg.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/gmp.so' - /usr/lib/php5/20060613+lfs/gmp.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/php_mapscript.so' - /usr/lib/php5/20060613+lfs/php_mapscript.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mhash.so' - /usr/lib/php5/20060613+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/ming.so' - /usr/lib/php5/20060613+lfs/ming.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mssql.so' - /usr/lib/php5/20060613+lfs/mssql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/odbc.so' - /usr/lib/php5/20060613+lfs/odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pdo_dblib.so' - /usr/lib/php5/20060613+lfs/pdo_dblib.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pdo_odbc.so' - /usr/lib/php5/20060613+lfs/pdo_odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pdo_pgsql.so' - /usr/lib/php5/20060613+lfs/pdo_pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pdo_sqlite.so' - /usr/lib/php5/20060613+lfs/pdo_sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pgsql.so' - /usr/lib/php5/20060613+lfs/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/tidy.so' - /usr/lib/php5/20060613+lfs/tidy.so: cannot open shared object file: No such file or directory in Unknown on line 0
Ignoring installed package pear/mail
Nothing to install
strange. it all worked so smoothly for me. which version of PHP do you have installed? and you are running as sudo right?
ReplyDeleteVery usefull Thaks
ReplyDeleteWorked great -- thanks.
ReplyDeleteBrilliant, thanks!
ReplyDeletehey sudhir
ReplyDeletehttps://bugs.launchpad.net/ubuntu/+source/php5/+bug/541439
this is what you have to do:
dpkg -P php5-mhash
Andrés Chandía
Found this website on google. I am searching for a solution to alter the [ FRM:www-data ] header. This shows up even when using the -f option headers type. I a using php5's mail() funtions.
ReplyDeletemail($to,$from,$msg,$header,'-f xxx@myserver.com');
perfect, just what I needed!
ReplyDeleteIt is showing this error :
ReplyDeleteDeprecated: Assigning the return value of new by reference is deprecated in /opt/lampp/lib/php/Mail.php on line 55
Deprecated: Assigning the return value of new by reference is deprecated in /opt/lampp/lib/php/Mail.php on line 135
Strict Standards: Non-static method Mail::factory() should not be called statically in /opt/lampp/htdocs/test.php on line 22
Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in /opt/lampp/lib/php/Mail/smtp.php on line 157
Warning: include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/bin/pear/') in /opt/lampp/lib/php/Mail/smtp.php on line 157
Fatal error: Class 'Net_SMTP' not found in /opt/lampp/lib/php/Mail/smtp.php on line 159
I apply the code in my file:
$from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo($mail->getMessage());
} else {
echo("Message successfully sent!");
}
?>
Works great thanks
ReplyDeleteHelps a lot! Thanks!
ReplyDelete