2014-03-26 14 views
0

編輯整個問題,我設法縮小它。這是代碼Wampserver不支持php代碼和正則表達式

<?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},它流暢的運行。

當這個錯誤ocurr的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

什麼是確切的錯誤(出現在日誌中)? – DanFromGermany

+0

oui.txt的內容是什麼,至少是一個重要的摘錄? – Toto

+0

[這裏](http://regexr.com/?38khn)是鏈接,出現的錯誤是[this](http://i.stack.imgur.com/iIopt.png) – user2495207

回答

0

你的正則表達式可以被簡化:

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

如果輸入的preg_match一些奇怪的循環,這應該解決的問題。

PCRE_DOTALL也使.知道換行符。

+0

Hi Robin,在_CHINA_之前還有一些剎車線,請看上面的鏈接。 – user2495207

+0

確實沒有想過。所以你的's'只是爲了匹配換行符?實際上有一個可以設置的標誌,以便'.'匹配換行符,我將進行編輯。 – Robin

0

原來這是Windows XP上的wampserver錯誤