something is configured wrong (pear and mail classes)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

something is configured wrong (pear and mail classes)

Post by jmilane »

This latest issue has come up because I am trying to send mail through a SMTP server but I cant figure out where to put the swiftmail folder (once it is extracted).

I dont know what is going on.

PHP tells me Fatal error: Class 'PEAR' not found in C:\apachefriends\xampp\php\pear\Net\Socket.php on line 35

And Fatal error: Class 'Mail' not found in C:\apachefriends\xampp\php\pear\Mail\smtp.php on line 26

Thing is... I have PEAR in my PHP folder and I have MAIL in my PEAR folder

Something is not configured correctly??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Pear requires some installation before it can be used. The documentation can be a bit hard to find.

http://pear.php.net/manual/en/installation.getting.php is the starting point.

Alternatively, you could use a different emailing package such as Swift or phpMailer.
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

feyd wrote:Pear requires some installation before it can be used. The documentation can be a bit hard to find.

http://pear.php.net/manual/en/installation.getting.php is the starting point.

Alternatively, you could use a different emailing package such as Swift or phpMailer.
I tried swift.

Both the Mail class and Pear class cannot be found:

Fatal error: Class 'PEAR' not found in C:\apachefriends\xampp\php\pear\Net\Socket.php on line 35

Fatal error: Class 'Mail' not found in C:\apachefriends\xampp\php\pear\Mail\smtp.php on line 26
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

jmilane wrote:I tried swift.
and?
jmilane wrote:Both the Mail class and Pear class cannot be found:

Fatal error: Class 'PEAR' not found in C:\apachefriends\xampp\php\pear\Net\Socket.php on line 35

Fatal error: Class 'Mail' not found in C:\apachefriends\xampp\php\pear\Mail\smtp.php on line 26
Thanks for repeating your original post. :roll:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

~jmilane, is there anything you need help with in swift? Or anything you find unclear in the documentation. I do like feedback... even bad feedback ;)
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

feyd wrote:
jmilane wrote:I tried swift.
and?
jmilane wrote:Both the Mail class and Pear class cannot be found:

Fatal error: Class 'PEAR' not found in C:\apachefriends\xampp\php\pear\Net\Socket.php on line 35

Fatal error: Class 'Mail' not found in C:\apachefriends\xampp\php\pear\Mail\smtp.php on line 26
Thanks for repeating your original post. :roll:
Dude, my original post actually says that I cannot figure out where to put the extracted swiftmail folder. I am trying to use swiftmail, and the errors I posted are what results.
8O
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

d11wtq wrote:~jmilane, is there anything you need help with in swift? Or anything you find unclear in the documentation. I do like feedback... even bad feedback ;)
Hey... yeah... I just dont know what to do with the folder once it is downloaded... I am kind of stupid I guess.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

jmilane wrote:
d11wtq wrote:~jmilane, is there anything you need help with in swift? Or anything you find unclear in the documentation. I do like feedback... even bad feedback ;)
Hey... yeah... I just dont know what to do with the folder once it is downloaded... I am kind of stupid I guess.
Just rename the entire folder from say "Swift-2.1.10" to "swift". Then upload that entire folder to your website somewhere where PHP can access it. You don't need to move any of the files out of the folder or anything, it will works as is.

Make sure you download the PHP4 version if you are using PHP4 or the other versions will give parse errors.

The errors you got did not come from the swift mailer library... those errors relate to PEAR and Swift Mailer has no class called. Mail.

http://www.swiftmailer.org/docs/ ;)
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

d11wtq wrote:
jmilane wrote:
d11wtq wrote:~jmilane, is there anything you need help with in swift? Or anything you find unclear in the documentation. I do like feedback... even bad feedback ;)
Hey... yeah... I just dont know what to do with the folder once it is downloaded... I am kind of stupid I guess.
Just rename the entire folder from say "Swift-2.1.10" to "swift". Then upload that entire folder to your website somewhere where PHP can access it. You don't need to move any of the files out of the folder or anything, it will works as is.

Make sure you download the PHP4 version if you are using PHP4 or the other versions will give parse errors.

The errors you got did not come from the swift mailer library... those errors relate to PEAR and Swift Mailer has no class called. Mail.

http://www.swiftmailer.org/docs/ ;)
Okay. You rock.

I will stick the swift folder right in the PHP folder.

I think that will work.

Thanks!
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

Warning: require(../../Swift.php) [function.require]: failed to open stream: No such file or directory in C:\apachefriends\xampp\htdocs\testswift.php on line 3

I know I am doing something really dumb. I dont know where to set this path. I have 2 php.ini files... one for php4 and one for php5. I am using php5. Nowhere in there do I see an include path.

I always hated having this problem with my eye but now I am really upset about it. There is so much to read.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

jmilane wrote:Warning: require(../../Swift.php) [function.require]: failed to open stream: No such file or directory in C:\apachefriends\xampp\htdocs\testswift.php on line 3

I know I am doing something really dumb. I dont know where to set this path. I have 2 php.ini files... one for php4 and one for php5. I am using php5. Nowhere in there do I see an include path.

I always hated having this problem with my eye but now I am really upset about it. There is so much to read.
Look at the path. Change the path in require() to match.

Code: Select all

require('swift/Swift.php');
require('swift/Swift/Connection/SMTP.php');
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

d11wtq wrote:
jmilane wrote:Warning: require(../../Swift.php) [function.require]: failed to open stream: No such file or directory in C:\apachefriends\xampp\htdocs\testswift.php on line 3

I know I am doing something really dumb. I dont know where to set this path. I have 2 php.ini files... one for php4 and one for php5. I am using php5. Nowhere in there do I see an include path.

I always hated having this problem with my eye but now I am really upset about it. There is so much to read.
Look at the path. Change the path in require() to match.

Code: Select all

require('swift/Swift.php');
require('swift/Swift/Connection/SMTP.php');
I just dont get it.

Doesnt work.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What's the full path to Swift.php?
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

feyd wrote:What's the full path to Swift.php?
C:\apachefriends\xampp\php\Swift

And this file that I am running is at

http://127.0.0.1/testswift.php

C:\apachefriends\xampp\htdocs is my root directory

so why isnt ../php/Swift/swift.php working?
Last edited by jmilane on Wed Aug 16, 2006 3:17 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

require('/apachefriends/xampp/php/Swift/Swift.php');
require('/apachefriends/xampp/php/Swift/Swift/Connection/SMTP.php');
would likely work then.
Post Reply