PHP/PEAR - include path error

Hi,

I successfully installed PEAR with the Mail() and Net_SMTP() libraries. When using the command line to check if they are present and working, PEAR replies everything is in place and stable.

Now, when using my mail script, PEAR replies me a fatal error when trying to send the form. I googled and found that most of the times the issue is related to a missing include_path function, but even with that I cant seem to get the script to work…

<?php
 require_once "Mail.php";
 include_path = ".;d:\wamp\bin\php\php5.2.6\PEAR"
 
 $from = "[email protected]";
 $to = "[email protected]";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";
 
 $host = "my.mailserver.com";
 $username = "myaccount";
 $password = "mypassword";
 
 $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>");
  }
 ?>

Please note that my PHP server is sitting on drive D.
How do I get rid of the " Class ‘PEAR’ not found in C:\php5\PEAR\Net\Socket.php on line 46" error??

Thanks,
A2k

Do you also have PHP setup in C? (the way windows would install it).

It may be giving priority to what is in your PATH.

Sponsor our Newsletter | Privacy Policy | Terms of Service