如何为每个目录设置 PHP 的 auto_prepend_file 指令? [英] How to set Php's auto_prepend_file directive per directory?

查看:20
本文介绍了如何为每个目录设置 PHP 的 auto_prepend_file 指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:在处理我想设置为 auto_prepend_file 的 php 页面之前,我有一些代码可以检查用户是否具有有效的会话.但是,我需要将用户尝试登录的页面从要求有效会话中排除.我希望能够在每个目录的基础上设置 auto_prepend_file 值.

Background: I've got some code that checks to see if a user has a valid session before processing the php page that I would like to set as the auto_prepend_file. However, I need to exclude the page where the user attempts to login from requiring a valid session. I would like to be able to set the auto_prepend_file value on an per directory basis.

环境:PHP 5.2.6m Apache 2,在 Windows(如果这很重要)和我可以完全控制的机器(不是托管环境)上运行 php 作为 cgi 而不是 mod_php

Environment: PHP 5.2.6m Apache 2, running php as a cgi not as mod_php, on Windows (if that matters) and on a machine that I have complete control over (not a hosted environment)

使用 htaccess 文件已失效 b/c 我没有使用 mod_php.我无法更改 php.ini 以设置 auto_prepend_file,服务器抛出内部错误.而且 ini_set() 不起作用 b/c 它已经加载了会话检查文件,然后我才能更改 auto_prepend_file 的值.

Using a htaccess file is out b/c I am not using mod_php. I have not been able to alter the in php.ini to set the auto_prepend_file, the server throws an internal error. And ini_set() does not work b/c it has already loaded the session checking file before I can change the value of auto_prepend_file.

如果您不使用 mod_php/htaccess,我看不到在每个目录的基础上设置 auto_prepend_file 的方法.我错过了什么吗?

I do not see a way to set auto_prepend_file on a per directory basis if you are not using mod_php/htaccess. Am I missing something?

推荐答案

使用 .user.ini 文件.

Use .user.ini files.

http://php.net/manual/en/configuration.file.per-user.php

这篇关于如何为每个目录设置 PHP 的 auto_prepend_file 指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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