Wampserver不带有正则表达式的PHP代码

时间:2014-03-26 13:53:28

标签: php regex wampserver

编辑整个问题,因为我设法缩小范围。这是代码

<?php
set_time_limit(0);
$file = file_get_contents("oui.txt");
preg_match_all("/[0-9ABCDEF]{6}(?=(?:.*?\s*)*CHINA)/", $file ,$out, PREG_PATTERN_ORDER);
var_dump($out);
?>

此代码使wampserver 2.3显示此网页不可用但是当我在这个代码中将正则表达式更改为任何更简单的例如[0-9ABCDEF]{6}时,它运行顺利。

当这个错误出现时,apache_error.log文件会说:

[Sun Mar 30 17:36:56 2014] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sun Mar 30 17:36:56 2014] [notice] Apache/2.2.23 (Win32) PHP/5.4.9 configured -- resuming normal operations
[Sun Mar 30 17:36:56 2014] [notice] Server built: Aug 24 2012 11:30:00
[Sun Mar 30 17:36:56 2014] [notice] Parent: Created child process 2376
[Sun Mar 30 17:36:56 2014] [notice] Child 2376: Child process is running
[Sun Mar 30 17:36:56 2014] [notice] Child 2376: Acquired the start mutex.
[Sun Mar 30 17:36:56 2014] [notice] Child 2376: Starting 64 worker threads.
[Sun Mar 30 17:36:56 2014] [notice] Child 2376: Starting thread to listen on port 80.

不知道它是否与我尝试访问任何文件夹时显示错误这一事实有关;

[Sun Mar 30 17:36:30 2014] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: http://localhost/anyfolder/

我没有Skype。 非常感谢你

2 个答案:

答案 0 :(得分:0)

您的正则表达式可以通过以下方式简化:

preg_match_all(
    "/[0-9ABCDEF]{6}(?=.*CHINA)/",
    $file,
    $out,
    PREG_PATTERN_ORDER|PCRE_DOTALL
);

如果preg_match进入一些奇怪的循环,这应该可以解决问题。

PCRE_DOTALL也让.了解换行符。

答案 1 :(得分:0)

原来它是Windows XP上的wampserver的错误