title: Need help in setting up PEAR in PHP
body: <p>I need to emails from my PHP script. The Server, which I have hosted my website on, does not allow the use of core PHP <code>mail()</code> function. They say I should write SMTP authentication code for sending emails.</p>
  
  <p>I need to use <code>require_once('System.php');</code> at the beginning of my PHP script, but the script execution stops beyond this line. In Apache logs of the Server, the log entry says:</p>
  
  <blockquote>
    <p>AH01071: Got error 'PHP message: PHP Warning: require_once(): open_basedir restriction in effect. File(/opt/plesk/php/5.6/share/pear/System.php) is not within the allowed path(s): (/var/www/vhosts/kbcsurveyors.com/:/tmp/) in /var/www/vhosts/kbcsurveyors.com/preinspection.kbcsurveyors.com/test-smtp-mail.php on line 20\nPHP message: PHP Warning: require_once(/opt/plesk/php/5.6/share/pear/System.php): failed to open stream: Operation not permitted in /var/www/vhosts/kbcsurveyors.com/preinspection.kbcsurveyors.com/test-smtp-mail.php on line 20\nPHP message: PHP Fatal error: require_on................</p>
  </blockquote>
  
  <p>kbcsurveyors.php is the domain that I have hosted.</p>
  
  <p>For SMTP authentication, I need to use PEAR. I had to include the <strong>path/to/pear</strong> in the <strong>php.ini</strong> on the Server. Since, the Server does not allow me to change its own <strong>php.ini</strong>, I copied it to my domain's folder and appended the <strong>path/to/pear</strong> to <code>include_path</code>.</p>
  
  <p>Here are commands I used and outputs I had from those commands:</p>
  
  <pre><code>shell_exec('cp /opt/plesk/php/5.6/etc/php.ini /var/www/vhosts/kbcsurveyors.com/httpdocs/includes');
  
  shell_exec('pear config-get php_dir');
  </code></pre>
  
  <blockquote>
    <p>OUTPUT: /usr/share/pear</p>
  </blockquote>
  
  <pre><code>shell_exec('php --ini');
  </code></pre>
  
  <blockquote>
    <p>OUTPUT: </p>
    
    <p>Configuration File (php.ini) Path: /etc</p>
    
    <p>Loaded Configuration File:         /etc/php.ini</p>
    
    <p>Scan for additional .ini files in: /etc/php.d</p>
    
    <p>Additional .ini files parsed:      /etc/php.d/00-ioncube-loader.ini,
    /etc/php.d/curl.ini,
    ....</p>
  </blockquote>
  
  <pre><code>echo get_include_path();
  </code></pre>
  
  <blockquote>
    <p>OUTPUT .:/opt/plesk/php/5.6/share/pear</p>
  </blockquote>
  
  <pre><code>echo 'Class Exists: '.(class_exists('System', false)) ? 'Yes' : 'No';
  </code></pre>
  
  <blockquote>
    <p>OUTPUT: Class Exists: Yes</p>
  </blockquote>
  
  <p>But again, require_once 'System.php'; throws the above error in Apache log.</p>
  
  <p>The <code>phpinfo()</code>ed a script. It shows the <code>include_path</code> as <strong>.:/opt/plesk/php/5.6/share/pear</strong> in both Local Value and Master Value.</p>
  
  <p>What mistake am I making? Please help.</p>
  
  <p>Thanks in advance</p>