Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Check To See If PEAR Is Installed On My Server or Not?

Tags:

php

email

pear

I am getting error like:

Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348

Warning: include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/lib/php/Mail/smtp.php on line 348

Fatal error: Class 'Net_SMTP' not found in /usr/local/lib/php/Mail/smtp.php on line 349

My code:

require_once 'Mail.php';

$from = "[email protected]>";

$to = "[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.example.com";

$username = "me";
$password = "test";

$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);

$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));
$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
 } else {
  echo("<p>Message successfully sent!</p>");
 }
like image 238
Navruk Avatar asked Mar 16 '11 14:03

Navruk


1 Answers

if you have ssh access, you can login and run

which pear

if it's installed it will print something like this

/usr/bin/pear
like image 91
Matt Ryan Avatar answered Nov 05 '22 19:11

Matt Ryan