我已经在Centos 6.7服务器上使用qdPM v9.0(来自qdpm / core / apps / qdPM / config / app.yml)和PHP 7.0.6以及apache 2.2.x和MariaDB 5.5.x一年多了没有任何的问题。它似乎使用传统的Symfony 1.4。
我尝试安装Let的加密SSL证书,并将此升级的Apache / httpd安装到2.2.15,PHP或MariaDB版本没有变化。
在SSL证书安装后重新启动httpd时,我突然收到500内部服务器错误,并且httpd错误日志显示:
...
[Wed Aug 09 14:55:22 2017] [error] [client x.x.x.x] Empty response header name, aborting request
[Wed Aug 09 14:55:32 2017] [error] [client x.x.x.x] Empty response header name, aborting request
...
此外,这不是SSL / Apache的错误配置,因为其他子域上的其他应用程序继续正常工作,无论是否使用Let的加密SSL证书。
谷歌没有帮助,除了一些德国讨论建议使用PHP 5.3:https://www.php.de/forum/webentwicklung/php-frameworks/1508593-installation-symfony-framework
Symfony 1最多只能运行PHP 5.3 ...这就是为什么我说你会得到Symfony 3 !!!
我清理了几次缓存。我删除了所有Let的加密SSL配置以及恢复旧的自签名SSL证书并将Apache配置恢复到之前的工作状态。
而且因为我们每天都进行备份,所以我甚至还在几个小时前恢复了整个代码备份。
这应该肯定有效。
我仍然得到相同的错误,没有关于如何调试它的线索/提示。 Symfony日志记录文档适用于其当前版本,而不适用于1.4
什么可能导致这个问题?
如何启用调试以便我可以找到错误“空响应头名称”的创建位置,以便我可以修补它?
我修改了函数它的工作原理:(php 7.0+)
第407行的... / core / lib / vendor / symfony / lib / response / sfWebResponse.class.php
/**
* Retrieves a normalized Header.
*
* @param string $name Header name
*
* @return string Normalized header
*/
protected function normalizeHeaderName($name)
{
$out = [];
array_map(function($record) use (&$out) {
$out[] = ucfirst(strtolower($record));
}, explode('-',$name));
return implode('-',$out);
}
这个版本也可以正常工作:
/**
* Retrieves a normalized Header.
*
* @param string $name Header name
*
* @return string Normalized header
*/
protected function normalizeHeaderName($name)
{
return preg_replace_callback('/\-(.)/', function ($matches) { return '-'.strtoupper($matches[1]); }, strtr(ucfirst(strtolower($name)), '_', '-'));
}
我能够将问题追溯到发送的标题
core/lib/vendor/symfony/lib/response/sfWebResponse.class.php
on line 357
价值观出了问题。
在PHP7上,qdPM 9.0运行正常一年多,直到Ubuntu 16.04的Apache 2更新出现。
但是,我发现了这个问题:
E_WARNING: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
.../core/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 409
但我没有得到旧的界限:
return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", strtr(ucfirst(strtolower($name)), '_', '-'));
转换,以便它将工作。据我所知,它应该用大写字母替换短划线后面的任何东西。但我不能让它与preg_replace_callback
合作:
return preg_replace_callback('\-(.)', function($m) { return '-'.strtoupper($m[1]); } , strtr(ucfirst(strtolower($name)), '_', '-'));
匿名函数根本不会被调用。我完全删除了preg替换,现在它工作正常。也许我们会在这里得到更新如何正确解决它。