包含文件路径问题 [英] include file path problem

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

问题描述

你好,


我在我的托管帐户上建立了一个开发版的实时网站。

但是开发版本在查找时遇到问题/>
包含文件。排除故障后,我可以通过从包含文件路径的开头删除../来解决问题

。但是

现在我正在考虑在所有

种类的文件中进行数百次修改。我想保持dev env类似于live env

所以我可以轻松地移植更改。下面是一个工作和非工作的例子包括文件定义:


working - include_once(" dblib / db_con.php");

非工作 - include_once(" ../ dblib / db_con.php");


但我不明白为什么这会在一台服务器上运行而不是

其他。在htaccess或php.ini中是否存在某种设置?

会影响这个? dev env正在运行php 5.2.6。感谢你的帮助。


- Raheem

Hello,

I built a development version of a live website on my hosted account.
However the development version is having problems with finding
include files. After troubleshooting I was able to resolve the issue
by removing the ../ from the beginning of the include file path. But
now I am looking at making this modification hundreds of times in all
kinds of files. I''d like to keep the dev env similar to the live env
so I can port changes easily. Below is an example of working and non-
working include file definitions:

working - include_once("dblib/db_con.php");
non-working - include_once("../dblib/db_con.php");

But I dont understand why this would work in one server and not the
other. Is there some kind of setting in htaccess or php.ini that would
affect this? The dev env is running php 5.2.6. Appreciate your help.

- Raheem

推荐答案

Raheem写道:
Raheem wrote:

您好,


我在我的托管帐户上构建了一个实时网站的开发版本。

但开发版本是查找问题

包括文件。排除故障后,我可以通过从包含文件路径的开头删除../来解决问题

。但是

现在我正在考虑在所有

种类的文件中进行数百次修改。我想保持dev env类似于live env

所以我可以轻松地移植更改。下面是一个工作和非工作的例子包括文件定义:


working - include_once(" dblib / db_con.php");

非工作 - include_once(" ../ dblib / db_con.php");


但我不明白为什么这会在一台服务器上运行而不是

其他。在htaccess或php.ini中是否存在某种设置?

会影响这个? dev env正在运行php 5.2.6。感谢你的帮助。


- Raheem
Hello,

I built a development version of a live website on my hosted account.
However the development version is having problems with finding
include files. After troubleshooting I was able to resolve the issue
by removing the ../ from the beginning of the include file path. But
now I am looking at making this modification hundreds of times in all
kinds of files. I''d like to keep the dev env similar to the live env
so I can port changes easily. Below is an example of working and non-
working include file definitions:

working - include_once("dblib/db_con.php");
non-working - include_once("../dblib/db_con.php");

But I dont understand why this would work in one server and not the
other. Is there some kind of setting in htaccess or php.ini that would
affect this? The dev env is running php 5.2.6. Appreciate your help.

- Raheem



第一个查看当前目录。第二个看起来在
一个目录下面。看起来你的测试和生产服务器之间的文件设置是不同的。


BTW - 我总是使用绝对路径而不是相对路径。这样,如果我移动一个包含其他内容的文件,它仍然有效,即


include(

The first one looks in the current directory. The second one looks in
one directory lower. It looks like your file setup is different between
your test and production servers.

BTW - I always use absolute paths instead of relative. That way if I
move a file that includes something else, it still works, i.e.

include (


_SERVER [''DOCUMENT_ROOT'']。''/ dblib / db_con.php'');


这将在web根目录的dblib中查找该文件。


PS如果你必须发布到多个新闻组,请交叉。不要
多重信息。


-

============== ====

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================

_SERVER[''DOCUMENT_ROOT''] . ''/dblib/db_con.php'');

This looks for the file in the dblib of the web root directory.

P.S. If you MUST post to multiple newsgroups, please crosspost. Don''t
multipost.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Jerry Stuckle写道:
Jerry Stuckle wrote:

Raheem写道:
Raheem wrote:

>您好,

我在托管帐户上构建了一个实时网站的开发版本。
然而,开发版本在查找包含文件时遇到问题。排除故障后,我可以通过从包含文件路径的开头删除../来解决问题。但是现在我正在考虑在所有类型的文件中进行数百次修改。我想保持dev env类似于live env
所以我可以轻松移植。以下是工作和非工作包含文件定义的示例:

工作 - include_once(" dblib / db_con.php");
非工作 - include_once( " ../ dblib / db_con.php");

但我不明白为什么这会在一台服务器上运行而不是
其他服务器。在htaccess或php.ini中是否有某种设置会影响这个? dev env正在运行php 5.2.6。感谢您的帮助。

- Raheem
>Hello,

I built a development version of a live website on my hosted account.
However the development version is having problems with finding
include files. After troubleshooting I was able to resolve the issue
by removing the ../ from the beginning of the include file path. But
now I am looking at making this modification hundreds of times in all
kinds of files. I''d like to keep the dev env similar to the live env
so I can port changes easily. Below is an example of working and non-
working include file definitions:

working - include_once("dblib/db_con.php");
non-working - include_once("../dblib/db_con.php");

But I dont understand why this would work in one server and not the
other. Is there some kind of setting in htaccess or php.ini that would
affect this? The dev env is running php 5.2.6. Appreciate your help.

- Raheem



第一个查看当前目录。第二个看起来在
一个目录下面。看起来你的测试和生产服务器之间的文件设置是不同的。


BTW - 我总是使用绝对路径而不是相对路径。这样,如果我移动一个包含其他东西的文件,它仍然有效,即


include(


The first one looks in the current directory. The second one looks in
one directory lower. It looks like your file setup is different between
your test and production servers.

BTW - I always use absolute paths instead of relative. That way if I
move a file that includes something else, it still works, i.e.

include (


这篇关于包含文件路径问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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