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();
}
I would debug like this in order to check which process stuck.
<?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";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With