0

First things first, my site is hosted on a Linux CentOS server and it already has the complete PEAR package in /usr/share/PEAR. I have written a send mail script using smtp and I want to include the server's PEAR/Mail.php in sendMail.php. Below is the site root structure:

Site: /var/www/html/buxx/
  SendMail/
   index.php
   sendMail.php

PEAR on Server
/usr
   /share
    /PEAR
     /Mail.php

I've tried to use set_include_path(".:/usr/share/PEAR/"), realpath(/usr/share/PEAR/Mail.php) and include_once("/usr/share/PEAR/")

but I keep getting errors like

[ERROR] include_once(): Failed opening '' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/buxx/SendMail/sendMail.php

how do I include the absolute path to Mail.php in sendMail.php or is there any other way around this?

Many Thanks

CeganB
  • 3
  • 4

2 Answers2

0

It looks like your include path is already correct.

include "Mail.php" should do it.

Farkie
  • 3,307
  • 2
  • 22
  • 33
  • Thanks farkie I have tried that but I still get this "Warning: include_once(): Failed opening 'Mail.php' for inclusion (include_path='.:/usr/share/PEAR/') in /var/www/html/buxx/SendMail/sendMail.php on line 2..." and a HTTP Error 500 – CeganB May 27 '13 at 15:38
  • Does PHP have access to /usr/share/PEAR/? – Farkie May 27 '13 at 15:41
  • How do I check this? I have checked the file permissions for PEAR/ and its 757 r-x. I've also tried using .htaccess to set include path without success as follows: RewriteEngine On #php_value include_path ".;C:\wamp\bin\php\php5.3.13\PEAR" php_value include_path ".:/usr/share/PEAR" – CeganB May 27 '13 at 15:54
0

What you need to do first is to make sure the pear mail.php is installed in your server.
You need to go to Home in your control panel under Software/Services click PHP PEAR Packages then locate the search box for finding PHP Extensions and Application Packages.
In the search box type Mail and click Go or submit the search form. Allow the next page to load fully because it takes time depending on the speed of your connection.

You will have all the PHP Extentions available in your control panel. Click install to install the extension. After installing go back to Home in your control panel under Software/Services click the PHP PEAR Packages link. Under Location of Your PHP Extension(s) and Application(s) you will have the path to the PHP Extension. You should something like this /home/yoursitedomain/php, this path you will include in include_once(/home/yoursitedomain/php/Mail.php).
I beleive this will work. This is how I configured my server to make it work for me.

Thank you.

Dipto
  • 2,720
  • 2
  • 22
  • 42
charly
  • 21
  • 5