我一直收到以下错误:
Wed Mar 30 01:22:43.780576 2016] [fastcgi:error] [pid 12345:tid 1234567890] [client 123.459.78.123:12345] FastCGI: incomplete headers (0 bytes) received from server "/path/to/php5-fcgi", referer: http://example.com/some/file.php
仅当我访问特定页面(控制器)时才会发生这种情况。令我更加困惑的是,这个错误似乎是随机的。这意味着有时我可以访问该页面,其他时候我一直都会收到该错误。
我正在讨论的页面是Prestashop 1.5.4的后台,特别是订单页面(Backoffice> Orders> Order)。
该页面确实向MySQL发送了一个查询(如何花费不到一秒钟)。这是完整的查询(已调试):
SELECT SQL_CALC_FOUND_ROWS
a.`id_order`,`reference`,`total_paid_tax_incl`,`payment`,a.date_add as date_add,
a.id_currency,
a.id_order AS id_pdf,
CONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) AS `customer`,
osl.`name` AS `osname`,
os.`color`,
IF((SELECT COUNT(so.id_order) FROM `ps_orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new
FROM `ps_orders` a
LEFT JOIN `ps_customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `ps_order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `ps_order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = 1)
WHERE 1
ORDER BY a.id_order DESC LIMIT 0,50;
我最大的疑问是查询有问题,因为当我使用MySQL Workbench运行该查询时,初始运行大约需要2秒。当我再次运行查询时(紧接在第一个之后),它花了~0.059(可能是缓存)。
任何人都可以帮我吗?
我使用的是Ubuntu 14.04 PHP 5.5.9 Apache 2.4.7(使用PHP5-FPM)
**编辑**
我跑的时候:
sudo tail -f /var/log/upstart/php5-fpm.log
这就是我得到的:
[04-Apr-2016 10:55:54] WARNING: [pool www] child 37686 exited on signal 11 (SIGSEGV - core dumped) after 111.726966 seconds from start
[04-Apr-2016 10:55:54] NOTICE: [pool www] child 38128 started
[04-Apr-2016 10:55:54] WARNING: [pool www] child 37774 exited on signal 11 (SIGSEGV - core dumped) after 81.831809 seconds from start
[04-Apr-2016 10:55:54] NOTICE: [pool www] child 38129 started
[04-Apr-2016 10:55:54] WARNING: [pool www] child 37798 exited on signal 11 (SIGSEGV - core dumped) after 76.299913 seconds from start
[04-Apr-2016 10:55:54] NOTICE: [pool www] child 38130 started
[04-Apr-2016 10:55:54] WARNING: [pool www] child 37768 exited on signal 11 (SIGSEGV - core dumped) after 83.162501 seconds from start
[04-Apr-2016 10:55:54] NOTICE: [pool www] child 38131 started
[04-Apr-2016 10:55:57] WARNING: [pool www] child 37859 exited on signal 11 (SIGSEGV - core dumped) after 65.427848 seconds from start
[04-Apr-2016 10:55:57] NOTICE: [pool www] child 38133 started
现在执行有问题的页面时会出现新的警告/通知/错误。
**编辑2 ** 我想在打开fpm配置上的slow_log后缩小问题范围。这就是我得到的:
script_filename = /path/to/some/script.php
[0x00007f55bb18afd8] query() /path/to/some/script/DbPDO.php:80
[0x00007f55bb18aef8] _query() /path/to/some/script/Db.php:305
[0x00007f55bb18ad88] query() /path/to/some/script/Db.php:482
[0x00007f55bb18ab68] executeS() /path/to/some/script/AdminController.php:2198
[0x00007f55bb18a9e8] getList() /path/to/some/script/AdminController.php:1531
[0x00007f55bb18a8d0] renderList() /path/to/some/script/AdminController.php:1440
[0x00007f55bb18a788] initContent() /path/to/some/script/Controller.php:167
[0x00007f55bb18a5d0] run() /path/to/some/script/Dispatcher.php:349
[0x00007f55bb18a480] dispatch() /path/to/some/script/index.php:50
更好的猜测是因为这个功能:
[0x00007f55bb18ab68] executeS() /path/to/some/script/AdminController.php:2198
它基本上发送我之前提到的查询。改变这意味着我必须改变Prestashop的核心引擎。我不希望这样做,因为它可能与其他函数/模块有一些依赖关系。
我想知道是否有一种方法可以稍微增加我的php-fpm或Apache的超时。我知道这样的解决方案存在,我只是不知道在哪里看/开始。