Jump to content

Starting Pear


ameliabob

Recommended Posts

I am just starting to try and use PEAR and the email. All of the examples show Include ("Pear.php"). The only thing that I can find in my wamp installation is a go-pear.phar. Using the include pear.php says no such file or directory. I am going through an SMTP server. What am I missing?

Link to comment
Share on other sites

More particularly (since the manual is deep):http://pear.php.net/manual/en/installation.getting.phpYou already have the file, just follow the rest.BTW, you might like to try the next gen PEAR installer, Pyrus:http://pear2.php.net/(installation instructions... they're pretty much the same as for PEAR)

Link to comment
Share on other sites

Ok, now I got PEAR to load. I went thru all of the verify and when I try to execute

<?phprequire ("c:\wamp\bin\php\php5.3.0\PEAR\PEAR.php"); $from = "Sandra Sender <sender@example.com>";$to = "ameliabob@gmail.com";$subject = "Test of email";$txt = "Hello world!";$headers = "From: webmaster@comsum.com" . "\r\n" ."CC: sobob@bellsouth.net";# *******************************************   $body = "Hi,\n\nHow are you?";  $host = "192.168.1.230"; $username = "qwer"; $password = "01234;xyz";  $headers = array ('From' => $from,   'To' => $to,   'Subject' => $subject); $smtp = Mail::factory('smtp',   array ('host' => $host,	 'auth' => true,	 'username' => $username,	 'password' => $password));?>

The require works but it does not find the Mail class. What have I missed here? and BTW all of the pyrus says that they are all alpha. That makes me a little nervous.

Link to comment
Share on other sites

You need to add the path to the Pear folder to PHP's include path. You can either set the include path in php.ini, which would be better, or you can set it in each script like example 2 shows here: http://www.php.net/manual/en/function.set-include-path.php You need to have it set up so that all you do is this: require 'Pear.php'; and it finds the file. The Pear directory needs to be in the include path because all of the Pear files which include other Pear files rely on that directory being in the include path.

Link to comment
Share on other sites

As I am slowly going forward with this I am getting further and further without getting the Mail/mail function. I have installed PEAR with the go-pear.phar. The includes all point to c:\wamp\bin\php\php5.3.0\pear But there is no Mail folder or mail.php. What installation step does this?

Link to comment
Share on other sites

Once you install Pear itself then you can use that to install the various packages for Pear, like Mail. Installing the base Pear files doesn't automatically install all packages also. This page shows the commands to install the Mail package, near the top: http://pear.php.net/package/Mail/download

Link to comment
Share on other sites

More particularly (since the manual is deep): http://pear.php.net/manual/en/installation.getting.php You already have the file, just follow the rest. BTW, you might like to try the next gen PEAR installer, Pyrus: http://pear2.php.net/ (installation instructions... they're pretty much the same as for PEAR)
OK, I have gone out and updated to php 5.3.8 and downloaded pyrus. The first thing I tried wasphp pyrus.phar list-packages and got the message "The sqlite3 extension is required. You must compile PHP with sqlite3 enabled or install the necessary extension for your distribution." I then went to the extension in the wamp/php menu and enabled the sqlite3 extension. Same message. Then the sqlite extension. Same message. Both of them together and still the same message. What should I try next?
Link to comment
Share on other sites

I would advice installing the WAMP stack manually, but that's just because I'm too lazy to bother with automatic stuff.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...