簡體   English   中英

谷歌翻譯卷曲使用php 5.3.8中的Up All Memory

[英]Google Translate Curl Using Up All Memory in php 5.3.8

我一直用它來將基本站點文本翻譯成不同的語言。 它一直運行良好,直到我更新到PHP 5.3.8。 它通過耗盡所有內存完全取下了我的服務器。 我究竟做錯了什么? 我肯定會說我會得到很多評論:)

try {
    $gt = new Gtranslate;
    $gt->setRequestType('curl');

    $SQL    = "SELECT * FROM PAGE_CONTENT WHERE live_page = '1'";
    $result = mysql_query($SQL);
    while ($row = mysql_fetch_array($result)) {
        $page_id_sub    = $row["page_id"];
        $page_title     = $row["page_title"];
        $page_permalink = $row["page_permalink"];

        if (empty($mylang)) {
            echo "<a href='/$permalink/$page_permalink.html'>$page_title</a> |";
        } else {
            $page_trans = $gt->$mylang("$page_title");
            echo "<a href='/$permalink/$page_permalink.html'>$page_trans</a> |";
        }
    }
} catch (GTranslateException $ge) {
    echo $ge->getMessage();
}

我會像這樣調試,以檢查哪個進程卡住了。

<?php

echo "\n start: " . memory_get_usage() . "\n";

  try{
    $gt = new Gtranslate;
    $gt->setRequestType('curl');

    echo "\n after class: " . memory_get_usage() . "\n";

    $SQL = "SELECT * FROM PAGE_CONTENT WHERE live_page = '1'";
    $result = mysql_query( $SQL );

    echo "\n after query: " . memory_get_usage() . "\n";

    while( $row = mysql_fetch_array( $result ) ) {
      $page_id_sub = $row["page_id"];
      $page_title = $row["page_title"];
      $page_permalink = $row["page_permalink"];

      if(empty($mylang)){
         echo "<a href='/$permalink/$page_permalink.html'>$page_title</a> |";
      }
      else {
         $page_trans = $gt->$mylang("$page_title");
         echo "<a href='/$permalink/$page_permalink.html'>$page_trans</a> |";
      }
    }
    echo "\n after while: " . memory_get_usage() . "\n";

  }
  catch (GTranslateException $ge){
    echo $ge->getMessage();
  }

echo "\n end: " . memory_get_usage() . "\n";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM