0
我們有三臺服務器運行我們的主站點。他們使用完全修補/更新的Window Server 2008 R2和MySQL 5.5。服務器在WordPress上的行爲有所不同
第一臺和第二臺服務器沒有問題。但是,第三臺服務器(與第二臺服務器在物理上相同,但網絡有點不同 - 第二臺服務器使用的是Meraki設備)存在問題。
我們實現了一個使用getimagesize()函數的自定義WordPress插件(通常在函數前使用@,但是我已經刪除了這個以嘗試查看錯誤)。我也禁用了Windows防火牆來覆蓋我的基地。
在第三臺服務器上,當加載WordPress後端時,它停在包含以下代碼的函數中。日誌顯示沒有特定的錯誤,並且頁面錯誤只是超過了最大時間(目前是6分鐘來測試此問題)。 php通過IIS7上的FastCGI運行。
任何有關可能導致這種情況的見解,將不勝感激!
這裏是循環:
$doc = new DOMDocument;
$internalErrors = libxml_use_internal_errors(true);
$doc->loadHTML($contentNoReferences);
libxml_use_internal_errors($internalErrors);
$totalImages = 0;
// Gather image data
foreach($doc->getElementsByTagName('img') as $img)
{
$fileName = $img->getAttribute('src');
$ignoreFileDimensions = true;
// Exclusion cases... CTAs, charts, infographics, graphs, and diagrams (treat _ as -)
$checkName = str_replace('_', '-', $fileName);
if(strpos($checkName, '-CTA-') === false &&
strpos($checkName, '-CTA.') === false &&
stripos($checkName, '-chart-') === false &&
stripos($checkName, '-chart.') === false &&
stripos($checkName, '-diagram-') === false &&
stripos($checkName, '-diagram.') === false &&
stripos($checkName, 'infograph') === false &&
stripos($checkName, 'graph') === false)
{
$ignoreFileDimensions = false;
}
$totalImages++;
$lastSlash = strrpos(str_replace('\\', '/', $fileName), '/');
$fileName = substr($fileName, $lastSlash + 1, strlen($fileName));
$fileStats = getimagesize(get_option('siteurl') . '/../images/' . $fileName);
if($ignoreFileDimensions)
{
$fileStats[0] = -1;
$fileStats[1] = -1;
}
if($fileStats)
{
$images[] = array('filename' => $fileName, 'type' => $fileStats['mime'],
'width' => $fileStats[0], 'height' => $fileStats[1],
'size' => remote_file_size(get_option('siteurl') . '/../images/' . $fileName),
'class' => $img->getAttribute('class'),
'title' => $img->getAttribute('title'), 'alt' => $img->getAttribute('alt'));
}
}
你確定'getimagesize'存在嗎? – cwallenpoole
@cwallenpoole感謝您的建議。我也考慮過這一點,並已經驗證getimagesize是一個有效的功能。 – illmortem
您能測量下載文件需要多少時間嗎? ('$ fl = sys_get_temp_dir()。'/'。$ fileName; file_put_contents($ fl,file_get_contents(get_option('siteurl')。'/../images/'。$ fileName);') – cwallenpoole