New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
require('mail.php') is not working
im going to send email via SMTP
when i add this code.
<?php
require('mail.php');
?>
Its display error like this
Warning: require(mail.php) [function.require]: failed to open stream: No such file or directory in /home/USERNAME/public_html/test2.php on line 2
Warning: require(mail.php) [function.require]: failed to open stream: No such file or directory in /home/USERNAME/public_html/test2.php on line 2
Fatal error: require() [function.require]: Failed opening required 'mail.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/USERNAME/public_html/test2.php on line 2
Comments
Erm...
This means mail.php does not exist lol
http://www.tizag.com/phpT/
Please learn PHP. Simply copy pasting code from all over the place isn't going to help you.
Put mail.php in the same directory as test2.php.
>
This. Or find the correct path /home/USERNAME/public_html/directory/mail.php and use that in require.
I see no point in making him use absolute paths, it's just going to make it all more complicated.
@Bogdacutuu Considering what he is attempting to do and the fact that he should understand the error messages being received to begin with I would respectfully disagree. And absolute paths really aren't the issue. He simply isn't understanding the function, the relationship involved in paths, more simply, and more importantly the location of the file to begin with. If his starting point is the file he is adding code to and the mail php file is in a subdirectory one might have even opted to go for require(dirname(__FILE__).'/directory/mail.php'); ..but if it is not I would suggest he use absolute to maintain what is most likely a more proper application directory structure + avoid greater confusion with functions. This one is just about understanding IMHO, you are complicating the issue by denouncing c+p to the OP in light of others' suggestions to copy the file to the same directory. I would never suggest anyone does that to an unknown application structure as it may also create a security risk.
It sounds like you are missing php-mail.
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
apt-get install php-mail
Um..no? He can't include mail.php because the file doesn't exist..it says that in the damn error message ffs.
Either it doesn't exist, or the permissions for accessing the file are messed up.
But if the module was installed the "mail.php" file (although he hasn't capitalised the Mail like he should have) would be in the PHP include paths - very much like when installing Java SDK you have to edit your windows environment paths (not sure if thats the correct name for them).
@OP, try changing "mail.php" to "Mail.php"?
More info for @MrObvious: http://stackoverflow.com/questions/15172383/pear-mailer-not-found-failed-opening-required-mail-php
@Jono20201 that's what I get for replying to something after just waking up