MTVS
MTVS

Reputation: 2096

How should I include files from outside of document root?

I wanted to include pear/Mail.php.
I asked the hosting support to provide me the path, It is "/usr/local/php-5.3.17/share/pear/". But it doesn't work independently or from document root, and it seems I can't access upper level directories by using "../".

There are two parent folder for the document root: /home/www/

Upvotes: 1

Views: 384

Answers (3)

Thorsten
Thorsten

Reputation: 3122

include '/usr/local/php-5.3.17/share/pear/Mail.php';

Upvotes: -1

MTVS
MTVS

Reputation: 2096

after recontacting the support team they stated that the error

require_once(/usr/local/php-5.3.17/share/pear/Mail.php) [function.require-once]: failed to open stream: No such file or directory in ...

is due to SMTP outgoing server connections are disabled.

Upvotes: 0

mohammad mohsenipur
mohammad mohsenipur

Reputation: 3149

you have two way

1) by including in php.ini

like

 ; UNIX: "/path1:/path2"
 ;include_path = ".:/php/includes"
 ;window
 include_path = ".;c:\php\includes;C:\wamp\ZendFramework-1.11.11\library"

2)add pear directory as valid directory in Apache Config like

 <Directory "/usr/share/rrdtool/fonts/">
    Options All
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

Upvotes: 2

Related Questions