谷歌翻译 Curl 耗尽 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();
}
I have been using this to translate basic site text in to different languages. It has worked great until I updated to PHP 5.3.8. It completely took down my server by using up all the memory. What am I doing wrong? I'm sure by saying that I'll get a lot of comments :)
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();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会像这样进行调试,以检查哪个进程卡住了。
I would debug like this in order to check which process stuck.