2014-05-21 96 views
0

我使用wordpress擴展來創建XML文件輸出。然而,只有(非常小的)輸出si部分正確生成。如果我嘗試從另一個站點訪問該XML(我需要XML並且該站點連接在一起),則會從站點響應500內部服務器錯誤。下面是錯誤日誌的一部分:創建XML文件給出內部服務器錯誤

www.auto-flex.eu [Wed May 21 18:58:35.078213 2014] [-:error] [pid 9298] [client 92.240.253.180:54919] PHP Warning: fopen(/nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-content/plugins/ankona-fields-polia/polia.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3879, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 18:58:35.078467 2014] [-:error] [pid 9298] [client 92.240.253.180:54919] PHP Warning: fread() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3882, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 18:58:35.078590 2014] [-:error] [pid 9298] [client 92.240.253.180:54919] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3885, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 18:58:35.379629 2014] [-:error] [pid 9298] [client 92.240.253.180:54919] PHP Warning: fopen(/nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-content/plugins/ankona-fields-polia/polia.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3879, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 18:58:35.379744 2014] [-:error] [pid 9298] [client 92.240.253.180:54919] PHP Warning: fread() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3882, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 18:58:35.379803 2014] [-:error] [pid 9298] [client 92.240.253.180:54919] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3885, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 19:00:38.025588 2014] [-:error] [pid 9364] [client 92.240.253.180:59625] PHP Warning: fopen(/nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-content/plugins/ankona-fields-polia/polia.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3879, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 19:00:38.025663 2014] [-:error] [pid 9364] [client 92.240.253.180:59625] PHP Warning: fread() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3882, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 19:00:38.025708 2014] [-:error] [pid 9364] [client 92.240.253.180:59625] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3885, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 19:00:38.138559 2014] [-:error] [pid 9364] [client 92.240.253.180:59625] PHP Warning: fopen(/nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-content/plugins/ankona-fields-polia/polia.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3879, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 19:00:38.138630 2014] [-:error] [pid 9364] [client 92.240.253.180:59625] PHP Warning: fread() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3882, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 
www.auto-flex.eu [Wed May 21 19:00:38.138672 2014] [-:error] [pid 9364] [client 92.240.253.180:59625] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-includes/functions.php on line 3885, referer http://www.auto-flex.eu/wp-admin/admin.php?page=heureka-feed/feed.php 

我知道這些都只是PHP的警告,而不是錯誤,但我認爲,這就是爲什麼插件不工作的原因。我相信我的htaccess文件只有一些問題。現在它是唯一的基本WP htaccess文件,它看起來是這樣的:從的functions.php

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

代碼:

function get_file_data($file, $default_headers, $context = '') { 
    $fp = fopen($file, 'r'); 
    $file_data = fread($fp, 8192); 
    fclose($fp); 
    $file_data = str_replace("\r", "\n", $file_data); 
    if ($context && $extra_headers = apply_filters("extra_{$context}_headers", array())) { 
     $extra_headers = array_combine($extra_headers, $extra_headers); // keys equal values 
     $all_headers = array_merge($extra_headers, (array) $default_headers); 
    } else { 
     $all_headers = $default_headers; 
    } 

    foreach ($all_headers as $field => $regex) { 
     if (preg_match('/^[ \t\/*#@]*' . preg_quote($regex, '/') . ':(.*)$/mi', $file_data, $match) && $match[1]) 
      $all_headers[ $field ] = _cleanup_header_comment($match[1]); 
     else 
      $all_headers[ $field ] = ''; 
    } 

    return $all_headers; 
} 

對此有何建議?

感謝您的轉發。

+0

你可以從3879行的functions.php中提供一些代碼嗎? – Stefan

+0

我已將它添加到我的帖子,但它只是一般的functions.php文件,它帶有WP,所以我不認爲問題應該在那裏。我相信它必須用htaccess標題做些事情。 – horin

+0

fopen不使用htaccess,因爲它使用本地路徑。如果路徑結構正確且文件存在,您可以手動檢查嗎? – Stefan

回答

0

你所得到的錯誤,因爲你正試圖fopen()該文件不存在 - 根據記錄它試圖打開/nfsmnt/hosting1_2/0/3/031ab609-b23c-40f3-8d1b-6700b9221820/auto-flex.eu/web/wp-content/plugins/ankona-fields-polia/polia.php

下一個錯誤的fread()fclose()是因爲fopen()返回false而不是文件句柄。