Php配置 - 包括路径问题 [英] Php configuration - include path problem

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

问题描述




我有一个PHP脚本位于: http://localhost/browse/script.php

此脚本为URL-rewrited;如 http://localhost/welcome.htm


此脚本包含其他脚本,代码如下:


<?php

include(" ../ inc / connect.php") ;

....

?>


当我直接输入: http://localhost/browse/script.php =>它的工作原理

当我去的时候: http:// localhost / welcome。 htm =>错误找不到

" ../ inc / connect.php" !!


我刚刚更改了我的apache / php / mysql conf(不幸的是丢失了我之前的那个
):我切换到xampp 。

这个脚本以前用来完美地工作:-( !!!

我明白客户端代码的路径不同但是我没有/ br / >
理解为什么它与服务器代码可能相同!

我怀疑Apache / Php conf是我问题的原因......但我不能

找出来了!

你能帮助我吗,这是非常重要的。


提前致谢,

-

alex

解决方案

alex写道:



我有一个PHP脚本位于: http:/ /localhost/browse/script.php
此脚本是URL-rewrited,因为 HTT p://localhost/welcome.htm

此脚本包含其他脚本,代码如下:

<?php
include(" ; ../ inc / connect.php");
...
?>

当我直接输入: http://localhost/browse/script.php =>它的工作原理是


路径就像:

/home/user/www/inc/connect.php

当我走的时候to: http://localhost/welcome.htm =>错误找不到
" ../ inc / connect.php" !


路径如下:

/home/user/inc/connect.php

我明白路径是不同的客户端代码,但我不明白为什么它可能与服务器代码相同!


您可能已经使用inc设置了包含路径目录包括。


include_path ="。:。/ inc"

我怀疑Apache / Php conf是我问题的原因......但是我无法找到答案!
你能帮助我吗,这是非常重要的。

提前致谢,



>您可能已使用inc设置了包含路径。目录包括。


include_path ="。:./ inc"




谢谢,但这只适用于此特定文件。

实际上,我在许多不同的目录中有很多脚本(在同一台机器上有几个项目

:localhost / project_A,localhost / project_B,...) 。

如果必须更新include_path,我将无法维护。每次我得到一个新项目时都会获得


麻烦的是我之前从未改变过这个选项而且它曾经工作过。我不能理解为什么。


FYI:我在windows下运行,当前的include_path是:

include_path ="。; C:\Program Files \ xampp \ php \ pear \"


it''是xampp中的默认值。


>如果每次获得新项目时都必须更新include_path

var,我将无法维护。




对不起,这是一个错误... include_path中的''。''目录将

解决我的pb ......但它不会:'' - (


Hi,

I''ve got a php script located at : http://localhost/browse/script.php
This script is "URL-rewrited" as http://localhost/welcome.htm

This script includes other scripts with the following code :

<?php
include("../inc/connect.php") ;
....
?>

When I directly type : http://localhost/browse/script.php => it works
As when I go to : http://localhost/welcome.htm => Error could not find
"../inc/connect.php" !!

I''ve just changed my apache/php/mysql conf (and unfortunately lost the one I
had before) : I switched to xampp.
This script used to work perfectly before :-( !!!
I do understand that paths are different for the client code but I don''t
understand why it could be the same with server code !
I suspect Apache / Php conf to be the cause of my problem... but I can''t
find out !
Can you help me, it''s quite importante.

Thanks in advance,

--
alex

解决方案

alex wrote:

Hi,

I''ve got a php script located at : http://localhost/browse/script.php
This script is "URL-rewrited" as http://localhost/welcome.htm

This script includes other scripts with the following code :

<?php
include("../inc/connect.php") ;
...
?>

When I directly type : http://localhost/browse/script.php => it works
path is like:
/home/user/www/inc/connect.php
As when I go to : http://localhost/welcome.htm => Error could not find
"../inc/connect.php" !!
path is like:
/home/user/inc/connect.php
I do understand that paths are different for the client code but I don''t
understand why it could be the same with server code !
You may have had the include path set with the "inc" directory included.

include_path = ".:./inc"
I suspect Apache / Php conf to be the cause of my problem... but I can''t
find out !
Can you help me, it''s quite importante.

Thanks in advance,



> You may have had the include path set with the "inc" directory included.


include_path = ".:./inc"



thanks, but this would only work for this particular file.
In fact, I have many scripts in many different directories (several projects
on the same machine : localhost/project_A, localhost/project_B, ...).
I would be impossible to maintain if I had to update the "include_path" var
every time I get a new project.
The trouble is I never changed this option before and it used to work. I
can''t understand why.

FYI : I run under windows and my current "include_path" is :
include_path = ".;C:\Program Files\xampp\php\pear\"

it''s the default value in xampp.


> I would be impossible to maintain if I had to update the "include_path"

var every time I get a new project.



Sorry, this is a mistake... the ''.'' directory in the include_path would
solve my pb... but it doesn''t :''-(


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

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