簡體   English   中英

我應該如何包含來自文檔根目錄之外的文件?

[英]How should I include files from outside of document root?

我想包含pear/Mail.php
我要求托管支持為我提供路徑,它是"/usr/local/php-5.3.17/share/pear/" 但是它不能獨立運行,也不能從文檔根目錄運行,並且似乎無法使用"../"訪問上級目錄。

文檔根目錄有兩個父文件夾: /home/www/

你有兩種方法

1)通過包含在php.ini中

喜歡

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

2)添加梨目錄作為Apache Config中的有效目錄

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

在與支持團隊聯系后,他們指出該錯誤

require_once(/usr/local/php-5.3.17/share/pear/Mail.php)[function.require-once]:無法打開流:在...中沒有這樣的文件或目錄

是由於SMTP傳出服務器連接被禁用。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM