的.htaccess php_value include_path中不工作 [英] .htaccess php_value include_path not working
问题描述
我在当地的一个小项目。我在Windows下,并与XAMPP工作。我的文件目录结构为:
I have a small project in local. I'm working under Windows and with XAMPP. My file directory structure is:
根目录:
C:\xampp\htdocs\routes
在此文件夹中,我有我的 bootstrap.php中与我想初始化我的项目的配置。
Under this folder, I have my bootstrap.php with the configuration I want to initialize my project.
公共文件夹:
C:\xampp\htdocs\routes\htdocs
在此文件夹,我有我的的index.php 我的的.htaccess
Under this folder I have my index.php and my .htaccess.
这里面的的.htaccess 我有以下配置:
Inside this .htaccess I have the following configuration:
php_value include_path .:/routes
php_value auto_prepend_file bootstrap.php
如果我做的 get_include_path()在的index.php ,它显示的:/路径。
但是,我让我的网页浏览器的消息(输入后的http://本地主机/路由/ htdocs目录
)所有的时间是:
If I do a get_include_path() inside the index.php, it shows ".:/routes".
But the message I get on my web browsers (after typing http://localhost/routes/htdocs
) all the time is:
Fatal error: Unknown: Failed opening required 'bootstrap.php' (include_path='.:/routes') in Unknown on line 0
我已经尝试了很多include_path下的htaccess的内部组合:
I have tried a lot of combinations of include_path inside the .htaccess:
php_value include_path ".:/routes"
php_value include_path .:../routes
php_value include_path ".:./routes"
php_value include_path ".:routes"
...
我的httpd.conf的配置:
The configuration of my httpd.conf is:
DocumentRoot "C:/xampp/htdocs"
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory /routes>
AllowOverride all
</Directory>
如果c中的信息,我很难$ C $自举在的index.php ,它的工作原理(至少这告诉我,里面的引导的要求配置好)。 我不知道该怎么做我的项目识别bootstrap.php中。
If I hard code the info in bootstrap inside the index.php, it works (at least this tells me the requirements inside bootstrap are well configured). I don't know what to do for my project to recognize the bootstrap.php.
我在想什么?我究竟做错了什么?
What am I missing? What am I doing wrong?
感谢您在您的帮助
推荐答案
- 首先,
&LT;目录&GT;
块都有一个用于包括无影响。因为这不是一个Apache的查询,而是preprocessing订单。 - 二,使用绝对路径在你的include_path,使其独立于文件所在的文件坐着。
- 三,确保路径
bootstrap.php中
可打开您的Web服务器运行的用户,并且该文件本身是可读的。
- First, the
<Directory>
block has no effect for include. Since this is not an Apache query, but rather a preprocessing order. - Second, use absolute paths in your include_path, to make it independent from where your files are sitting.
- Third, make sure the path to
bootstrap.php
is openable by the user your webserver runs as, and that the file itself is readable.
这篇关于的.htaccess php_value include_path中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!