Search code examples
phppathincludegmailpear

PHP include path problems when using PEAR Mail on Bluehost


I am trying to modify a TemplateMonster template that uses PHP to email data from a form. It uses localhost as the email server by default, but my client already uses gmail's mail exchange servers and likes it that way. I am using the code from the top answer in this question: SO question

I think I have it all set up pretty well, except that the host installs PEAR and PHP to a predefined folder and I am working on a subdomain. I am getting errors about not being able to find mail.php although I have modified php.ini to try to include the correct path. Here is my error (with a few name changes to protect privacy of my client):

[08-Nov-2012 10:52:15] PHP Warning: require_once(../../mail.php) [function.require-once]: failed to open stream: No such file or directory in /home6/clientname/public_html/subdomainname/bin/contactFormHandler.php on line 3 [08-Nov-2012 10:52:15] PHP Fatal error: require_once() [function.require]: Failed opening required '../../mail.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear:/usr/php') in /home6/clientname/public_html/subdomainname/bin/contactFormHandler.php on line 3

And here is the tree: /home6/clientname/php/mail.php is the file I am trying to include /home6/clientname/public_html/subdomainname/bin/contactFormHandler.php is the file that is throwing the error

And here is my code from contactFormHandler.php that is the include: require_once "mail.php";

I have tried various iterations such as "../../../php/mail.php" to no avail. Any suggestions on what I need to do so that the PHP file on the subdomain can "see" the PEAR files I am trying to include?

Thank you!


Solution

  • Try Mail.php instead of mail.php

    the filename for the PEAR package is Mail.php and Unix/Linux systems are case-sensitive.