php open_basedir

在Mac的VMware下面配置了個虛擬機,php的集成開發環境使用的是lnmp,配置了pangu系統的虛擬機,提示以下錯誤:php

Warning: require(): open_basedir restriction in effect. File(/mnt/hgfs/php/api/config.inc.php) is not within the allowed path(s): (pangu/:/tmp/) in /mnt/hgfs/php/index.php on line 25 Warning: require(/mnt/hgfs/php/api/config.inc.php): failed to open stream: Operation not permitted in /mnt/hgfs/php/index.php on line 25 Fatal error: require(): Failed opening required './api/config.inc.php' (include_path='.:') in /mnt/hgfs/php/index.php on line 25

後來查Google發現是open_basedir會阻止打開不在open_basedir裏面指定目錄的文件,只要在php.ini配置open_basedir,把要引入的文件路徑加入便可api

------------------------------------------
[HOST=www.lnmp.org]
open_basedir=ls/:/tmp/
[PATH=ls]
open_basedir=ls/:/tmp/
[HOST=128.com]
open_basedir=/home/wwwroot/128.com/:/tmp/
[PATH=/home/wwwroot/128.com]
open_basedir=/home/wwwroot/128.com/:/tmp/:/mnt/hgfs/
相關文章
相關標籤/搜索