页:
[1]
|
测试了整整三天了,看似一个PHP或者APACHE的BUG
假设exp.php输出的内容中以SSI方式包含test.php,一般情况如下:
exp.php
[code]
<?php
define('AA','OK!');
?>
<!--#include virtual="test.php" -->
[/code]
test.php
[code]
<?php
echo AA;
?>
[/code]
运行exp.php后输出为AA,说明常量AA并没有被定义
-----------------------------------------------------------------
如果对exp.php进行改变如下:
exp.php
[code]
<?php
define('AA','OK!');
?>
<!--#include virtual="test.php" -->
...
(注意:假设此处存在大于30K 内容)
...
[/code]
test.php
[code]
<?php
echo AA;
?>
[/code]
惊奇地发现输出:
OK!
常量AA已经被定义
这个问题已经超出我个人的解释能力,希望在座有人来告知,谢谢
:)
[[i] 本帖最后由 php5 于 2007-3-2 09:14 AM 编辑 [/i]] |
| tianfing | 2007-3-2 01:51 AM |
|
| 试了一下,没有输出! |
|
| 没有输出是指???应该要先安装上SSI,然后再配置支持.PHP扩展名 |
| boysky85 | 2007-3-2 05:31 AM |
|
试试
你用的是什么版本的...
你试试
<?php
define ("AA", OK); //OK不要 ' ' 号
echo AA ;
?>
我试用过了输出没有问题啊.. |
| xieaotian | 2007-3-2 05:44 AM |
|
| 应该是PHP或APACHE设置问题,你第一个方法和第二个方法,均在我机器上通过测试。 |
|
[quote]原帖由 [i]xieaotian[/i] 于 2007-3-2 01:44 PM 发表
应该是PHP或APACHE设置问题,你第一个方法和第二个方法,均在我机器上通过测试。 [/quote]
你确定是以
<!--#include virtual="test.php" -->
的包含方式吗?
我说的不是
<?php
include('test.php');
?>
我在FreeBSD和WIN32平台上测试的结果都不可以 |
|
没想到在PHP官方站找到了答案,郁闷
[url]http://bugs.php.net/bug.php?id=35278[/url]
[18 Nov 2005 4:33pm UTC] maddog2k at maddog2k dot net
Description:
------------
Bug #35264 was fixed, but this introduced a new Apache child
segmentation fault, under some conditions.
With PHP 4.4.0 and below, the following would work correctly with Apache
2.0.54/.55 :
AddOutputFilter INCLUDES .php
AddType application/x-httpd-php .php
Then having a .php that contains multiple (eg. 2) <!--#include
virtual="/page.html" --> and for example about 24 thumbnails (of 4.0k
each), you read a segfault of an Apache child process in the error_log
and the page loading finishes and showing cut-off content.
Like I said, the segfault happens since the fix for bug #35264, before
it just didn't segfault but stopped loading.
When changing output_buffer to 0 or Off, no difference.
Only when I set output_buffer => 16384 in php.ini, the page loads
completely.
Strange thing here is that output buffering isn't used in the page at
all, or SSI by default must use buffering...
Seems to me that something has changed regarding buffering between 4.4.0
<-> higher versions.
Like the memory get's full or so, cause when I delete a few lines of
html-code in the page (random), it does load.
Noe that this does like an Apache bug or so, but hence it only happens
since PHP 4.4.1
Reproduce code:
---------------
Hopefully, the description rings a bell at you guys :)
But possible if really needed.
Expected result:
----------------
Page loads completely (100%)
Actual result:
--------------
Page loads not completely |
Powered by Discuz! Archiver 6.1.0
© 2001-2006 Comsenz Inc.
Processed in 0.007705 second(s), 2 queries | |
|
|