开发者

PEAR to send email from PHP script using a remote server with SMTP authentication

My php can't find mail.php

I installed the PEAR package in a directory named pear_admin I secured everything in that directory with .htaccess and .htpasswd When I go to mysite.com/pear_admin/index.php it asks for my username and password. This works and I am able to see and use PEAR Package Management I installed the Mail package. I created a php5.ini file and placed it in my root folder. When I click the submit button on my contact page, the PHP file finds php5.ini But then it goes wrong.

It can't find mail.php It's in the newly created directory. Which is different from where my Contact page is. php5.ini should solve that problem. The path in php5.ini is include_path = .:/usr/local/php5/lib/php:/home/content/91/5799191/html/mywebsite/pear_admin/PEAR

I tried quotes as well include_path = ".:/usr/local/php5/lib/php:/home/content/91/5799191/html/mywebsite/pear_admin/PEAR"

I'm not sure if there're any other solutions I need to try. I don't think I did anything wrong when 开发者_JAVA技巧I installed the Mail package. It's just a click of a button.

Maybe it's the PHP I tried both require_once "Mail.php"; and include('Mail.php');

Maybe it's because I secured it with .htpasswd That's something I don't understand. How can it access that file when I'm not giving it the username and password in my PHP? Shouldn't I be doing that? If so, how ?

Thank you.


You're confusing yourself over how .htpasswd protection works. PHP's already executing on the server, and does NOT go through the webserver to include external files. It can just access them directly - after all, they're on the same machine.

Of course, if you were using something that DOES do an http request (CURL, file_get_contents with an absolute url, etc...) then those WILL go via the webserver and be affected by the password protection.

You sayd you're doing include('Mail.php'), but say you installed mail.php. Remember that Unix-based servers have case-sensitive file systems, and Mail.php is a completely different file than mail.php. The same goes for your include path. If you install something in /tmp/FOO but attempt to access it via /tmp/foo, it won't work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜