简体   繁体   English

php.ini与.htaccess中的suPHP

[英]php.ini with suPHP in .htaccess

My server uses suPHP and so each website has it's own php.ini file. 我的服务器使用suPHP,所以每个网站都有自己的php.ini文件。 My host recommended adding the following in my .htaccess file: 我的主人建议在我的.htaccess文件中添加以下内容:

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/user/public_html
</IfModule>

This basically points to the site's php.ini file. 这基本上指向网站的php.ini文件。 However, I am trying to have a standard .htaccess file across all sites that I don't need to edit- basically part of my "boilerplate" site that I start off with. 但是,我试图在我不需要编辑的所有站点上都有一个标准的.htaccess文件 - 基本上是我开始使用的“样板”站点的一部分。 I tried to change the above to this: 我试图将上面改为:

<IfModule mod_suphp.c>
suPHP_ConfigPath %{DOCUMENT_ROOT}/public_html
</IfModule>

But this doesn't work. 但这不起作用。 As you can tell I am probably not understanding how this all works. 你可以告诉我,我可能不理解这一切是如何运作的。 Can anyone help me with the above code so that I don't need to put the exact path in for each .htaccess file, and get Apache to work out the path to my php.ini file? 任何人都可以帮助我使用上面的代码,这样我就不需要为每个.htaccess文件输入确切的路径,并让Apache计算出我的php.ini文件的路径?

I hope that makes sense, it's a little difficult to explain! 我希望这是有道理的,这有点难以解释!

Just doing a sweep of old suphp Qs. 只是扫一扫旧的suphp Qs。 mod_suphp uses the standard parameter parser so in principle %{DOCUMENT_ROOT} should work. mod_suphp使用标准参数解析器,因此原则上%{DOCUMENT_ROOT}应该有效。 The issue that you almost certainly have is that suPHP is generally used for shared hosting solutions and for these, the users effective DOCUMENT_ROOT is not the same as that established by the DocumentRoot directive in the system config. 您几乎可以肯定的问题是suPHP通常用于共享主机解决方案,对于这些,用户有效DOCUMENT_ROOT与系统配置中的DocumentRoot指令建立的不同。

Most vendors set up an environment variable to point at the users document root. 大多数供应商都设置了一个环境变量来指向用户文档根目录。 My host sets up DOCUMENT_ROOT_REAL, another that I've come across is PHP_DOCUMENT_ROOT. 我的主机设置了DOCUMENT_ROOT_REAL,我遇到的另一个是PHP_DOCUMENT_ROOT。 You need to look at your phpinfo() report to see what applies in your case. 您需要查看您的phpinfo()报告,看看您的案例中适用的内容。 So on my .htaccess, I use 所以在我的.htaccess上,我用

suPHP_ConfigPath %{ENV:DOCUMENT_ROOT_REAL}/_private

and that works fine for me. 这对我来说很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM