的.htaccess php_value AUTO_ prepend_file使500错误。我该如何解决这个问题? [英] .htaccess php_value auto_prepend_file makes 500 error. How can I fix this?

查看:477
本文介绍了的.htaccess php_value AUTO_ prepend_file使500错误。我该如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.htaccess如下:

My .htaccess is as follows:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /school
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9]+)$ index.php?page=$1

php_value auto_prepend_file ./inc/library.php

ErrorDocument 404 /school/index.php?page=404

作为 ./ ,我读到表示相对路径。

As of the ./, I read that indicates a relative path.

推荐答案

注:此信息是取近逐字从另一个网站,我认为这解释了这个问题很好,我高度怀疑这就是问题所在:

Note: This information was taken nearly verbatim from another website, I thought it explained the issue well and I highly suspect this is the problem:

有些PHP脚本在.htaccess文件中建议使用的php_value或的php_flag命令,如下例:

Some PHP scripts suggest using "php_value" or "php_flag" commands in .htaccess files, as in this example:

php_value  include_path         ".:/usr/local/lib/php" 
php_flag   display_errors       Off
php_value  upload_max_filesize  2M
php_value  auto_prepend_file    "./inc/library.php"

然而,有些服务器运行的CGI模式(而不是作为一个Apache模块),PHP的,所以你不能使用的php_value或的php_flag在.htaccess文件命令。如果你尝试这样做,你会看到一个内部服务器错误的信息。

However, some servers run PHP in "CGI mode" (not as an Apache module), so you can't use "php_value" or "php_flag" commands in .htaccess files. If you try to do so, you'll see an "internal server error" message.

您可以修改php.ini文件来获得同样的效果,虽然。事实上,修改php.ini文件实际上是比使用php_value或的php_flag更加灵活:有很多事情不能覆盖使用.htaccess文件,但您可以覆盖在php.ini文件中几乎所有的PHP设置

You can modify your php.ini file to get the same effect, though. In fact, modifying php.ini is actually more flexible than using php_value or php_flag: there are many things you can't override using .htaccess files, but you can override almost any PHP setting in the php.ini file.

要取得相同的效果的.htaccess线以上,则只需这些行添加到您的自定义php.ini文件:

To get the same effect as the .htaccess lines above, you would simply add these lines to your custom php.ini file:

include_path = ".:/usr/local/lib/php" 
display_errors = Off
upload_max_filesize = 2M
auto_prepend_file = "./inc/library.php"

请注意:有些系统将要求各地路径报价,有的不能使用引号

Note: Some systems will require quotes around the paths, and some must not use quotes.

这篇关于的.htaccess php_value AUTO_ prepend_file使500错误。我该如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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