du9537 2015-07-05 19:53
浏览 41

服务器上的一个目录没有使用正确的包含路径(使用php.ini设置)

I'm having some issues with one particular directory on my site, it cannot find my included php files that are outside of the root directory. What baffles me is that this is working for EVERY other page outside of this directory, but this particular directory will not set itself. I set my include paths in php.ini like so:

include_path = ".:/home1/(username)/inc:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear"

the files I'm trying to access are in the "inc" folder.

All I have in the file I'm running is include_once ('include.php');

which should, based on the php.ini settings, find the right file in the inc directory.

I've tried a couple different things to remedy this including setting the include path like so:

include (dirname($_SERVER['DOCUMENT_ROOT'].'/inc/include.php');

which also cannot find the correct file.

As well as changing my .htaccess located within that folder to manually set the include path for that particular directory.

# ALLOW USER BY IP
<Limit GET POST>
 order deny,allow
 deny from all
 allow from (ip of cron server)
</Limit>

# PREVENT VIEWING OF .HTACCESS
<Files .htaccess>
 order allow,deny
 deny from all
</Files>

#Set include path
php_value include_path ".:/home1/(username)/inc"

I am not sure if I did the .htaccess right but that method also produced the same error in my error.log file.

Heres the error.log file:

[05-Jul-2015 15:50:01] PHP Warning:  include_once(include.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home1/(username)/public_html/audit/check_expired_email_keys.php on line 7
[05-Jul-2015 15:50:01] PHP Warning:  include_once() [<a href='function.include'>function.include</a>]: Failed opening 'include.php' for inclusion (include_path='.:/usr/lib64/php:/usr/share/pear') in /home1/(username)/public_html/audit/check_expired_email_keys.php on line 7
[05-Jul-2015 15:50:01] PHP Fatal error:  Call to a member function query() on a non-object in /home1/(username)/public_html/audit/check_expired_email_keys.php on line 9

I'm at a loss right now for why this directory would fail to behave like the rest of the site is.

Some advice of any kind would really be helpful here.

Thanks in advance

::EDIT:: Issue was solved by moving cronjobs directly into super-root include directory.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?