1

我收到内部服务器错误,我认为一切设置正确,我将整个站点从旧主机带到新主机,现在我收到错误。看起来像这样的相同 .htaccess 文件

 # Mod Rewrite
 Options +FollowSymLinks
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]

 ## adjust memory limit

 # php_value memory_limit 64M 
 php_value memory_limit 256M 
 php_value max_execution_time 18000

不知道是什么问题,感谢任何帮助

请注意,该站点现在托管在 godaddy 上,我被告知我需要将以下行添加到 htaccess 以进行 modrewrite

#Fix Rewrite
Options -Multiviews

还是行不通

好的,所以终于得到了关于这个的错误报告,

[Wed Oct 10 15:05:09 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhapsmisspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:05:10 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:06:07 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:06:07 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:06:51 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:06:51 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:07:10 2012] [warn] [client 64.60.65.18] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Oct 10 15:07:10 2012] [error] [client 64.60.65.18] Premature end of script headers: index.php
[Wed Oct 10 15:07:10 2012] [warn] [client 64.60.65.18] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Oct 10 15:07:10 2012] [error] [client 64.60.65.18] Premature end of script headers: index.php
[Wed Oct 10 15:07:12 2012] [warn] [client 64.60.65.18] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Oct 10 15:07:12 2012] [error] [client 64.60.65.18] Premature end of script headers: index.php
[Wed Oct 10 15:07:12 2012] [warn] [client 64.60.65.18] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Oct 10 15:07:12 2012] [error] [client 64.60.65.18] Premature end of script headers: index.php
[Wed Oct 10 15:07:13 2012] [warn] [client 64.60.65.18] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Oct 10 15:07:13 2012] [error] [client 64.60.65.18] Premature end of script headers: index.php
[Wed Oct 10 15:07:13 2012] [warn] [client 64.60.65.18] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Oct 10 15:07:13 2012] [error] [client 64.60.65.18] Premature end of script headers: index.php
[Wed Oct 10 15:07:18 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Wed Oct 10 15:07:18 2012] [alert] [client 64.60.65.18] /var/chroot/home/content/23/9953123/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
4

2 回答 2

2

php_valueapache使用fastcgi/mod_fcgid时不能设置

尝试注释掉这些值,或者像这样封装它们

<IfModule mod_php5.c>
   php_value something_something  164M
</IfModule>

当我的主机升级服务器时,我遇到了同样的问题。从.htaccess中删除它们后,我将我的php_value语句放入 php;我认为有不止一种方法可以重新实现它们。)

于 2014-06-13T23:52:19.820 回答
0

几天来,我一直试图弄清楚这一点。就像原始问题显示的那样,我的 Apache 错误日志也报告“无效命令 'php_value',可能拼写错误或由服务器配置中未包含的模块定义”

最后,遇到评论“当 apache 使用 fastcgi / mod_fcgid 时您不能设置 php_value”是一个线索。因为我不知道那是什么意思,但它听起来与我的问题有关,所以我四处搜索并学到了很多重要的东西:

1) PHP 可以作为 Apache 模块或 CGI 二进制文件运行,这在设置 php 值方面有很大的不同。要找出你的,运行 phpinfo() [如果你不知道怎么做,请用谷歌搜索]。如果输出显示“php-fpm”,那么您的输出是作为 CGI 而不是作为 Apache 模块运行的。

2)如果你的作为 CGI 运行,那么你不能将 php_value 或任何其他 php 设置放在 .htaccess 中。您必须在 php.ini 中设置它们(其位置也在 phpinfo 输出中给出)或通过函数 ini_set 在您的 php 代码中设置。例如

ini_set('display_errors', '1');

3) 最重要的是:如果您更改了 php.ini,然后重新启动 Apache 并发现您的设置没有改变,这可能意味着您正在作为 CGI 而不是作为 Apache 模块运行。那么重新启动 Apache 不会重新加载 php.ini 是有道理的,因为它没有运行 php。要使更改发生,您必须重新启动 php-fpm 服务!(我已经把头发拉出来好几天了,因为我能找到的关于在 php.ini 中设置值的每个答案都说你更改了 php.ini 并重新启动 Apache 并且这只是工作。但它对我不起作用。这就是为什么.) 在我正在构建的系统上,即 Amazon AWS Linux 2 实例上,重新启动服务的命令是:

sudo systemctl restart php-fpm

你的可能不一样。

我希望这个答案可以帮助一些像我一样沮丧的人。

坦率

于 2019-02-03T17:25:11.377 回答