我应该如何包含文档根目录之外的文件?

时间:2023-02-05 12:46:32

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 "../".

我想包括pear / Mail.php。我要求托管支持为我提供路径,它是“/usr/local/php-5.3.17/share/pear/”。但它不能独立工作或从文档根目录,并且似乎我无法使用“../”访问上层目录。

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

文档根目录有两个父文件夹:/ home / www /

3 个解决方案

#1


2  

you have two way

你有两种方式

1) by including in php.ini

1)通过包含在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

2)在Apache Config中添加pear目录作为有效目录

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

#2


0  

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 ...

require_once(/usr/local/php-5.3.17/share/pear/Mail.php)[function.require-once]:无法打开流:没有这样的文件或目录...

is due to SMTP outgoing server connections are disabled.

是由于SMTP传出服务器连接被禁用。

#3


-1  

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

#1


2  

you have two way

你有两种方式

1) by including in php.ini

1)通过包含在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

2)在Apache Config中添加pear目录作为有效目录

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

#2


0  

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 ...

require_once(/usr/local/php-5.3.17/share/pear/Mail.php)[function.require-once]:无法打开流:没有这样的文件或目录...

is due to SMTP outgoing server connections are disabled.

是由于SMTP传出服务器连接被禁用。

#3


-1  

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