无法使用include包含文件php [英] unable to Include Files php using include

查看:123
本文介绍了无法使用include包含文件php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为index.php的页面,其中包含一个新页面new_display.php,它再次包含两个页面,即x.php和y.php



包含是在本地主机上工作正常,但不在我的主机上我得到的错误是: -



警告:require(/interests/sketching/udis.php)[function.require]:无法打开流: /hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php在第154行上没有这样的文件或目录



致命错误:require()[function.require]:打开所需的/interests/sketching/udis.php(include_path ='。:/ usr / local / lib / php-5.2.17 / lib / php ')在/hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php第154行



目录是:



index.php - > localhost / mysql



new_display.php - > localhost / mysql / interest / sketching / new_display.php (在index.php中包含/interests/sketching/new_display.php)



然后在new_display中将x.php和y.php作为



/interests/sketching/x.php



/interests/sketching/y.php



它在本地主机上工作得很好,但当我发布任何人都知道为什么这不起作用?

解决方案

/ 表示绝对路径,这意味着您的脚本正在文件系统的根目录中找到一个名为兴趣的目录



相反,请尝试在路径开头部分删除 / code> $ _ SERVER ['DOCUMENT_ROOT'] 给他们。


I have a page called index.php which includes a page new_display.php which again includes two pages i.e. say x.php and y.php

The include is working fine on localhost but not on my hosting! The error i am getting is :-

Warning: require(/interests/sketching/udis.php) [function.require]: failed to open stream: No such file or directory in /hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php on line 154

Fatal error: require() [function.require]: Failed opening required '/interests/sketching/udis.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php') in /hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php on line 154

The Directories are :

index.php -> localhost/mysql

new_display.php -> localhost/mysql/interests/sketching/new_display.php ( Included in index.php as /interests/sketching/new_display.php )

then in new_display x.php and y.php are included as

/interests/sketching/x.php

/interests/sketching/y.php

It works all good in localhost but gives error when i publish the pages on the Domain

Does anyone has any idea why isn't this working?

解决方案

/ indicates an absolute path, meaning your script is looking in the root of the filesystem for a directory called interests.

Instead, try just removing that / at the start of your paths, or prepend $_SERVER['DOCUMENT_ROOT'] to them.

这篇关于无法使用include包含文件php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆