Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved "MyBB has experienced an internal SQL error..." Error
#1
Not Solved
Hi, I'm getting the "MyBB has experienced an internal SQL error and cannot continue..." error when I try to run a plugin I'm developing on the server.

Locally it works great, not problem at all. At the server it gives the following error, after hanging for minutes:

Quote:Query:
SELECT t.subject,t.username,t.uid,t.tid,t.fid,t.lastpost,t.lastposter,t.lastposteruid,t​.replies, t.views,tr.uid AS truid,tr.dateline,f.name , TRUNCATE(t.totalratings/t.numratings*2+t.numratings/8+tyl_tnumtyls+t.replies+t.views/15,2) ranking FROM mybb_threads t LEFT JOIN mybb_threadsread tr ON (tr.tid=t.tid AND tr.uid='1') LEFT JOIN mybb_forums f ON (f.fid = t.fid) WHERE t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.dateline >=UNIX_TIMESTAMP()-(86400*360) ORDER BY ranking DESC LIMIT 0,1"

This is the main query to get the data for the plugin, but the error also shows sometimes other queries, like:

Quote:MyBB SQL Error
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
2006 - MySQL server has gone away
Query:
SELECT LOWER(url) AS url,id,idtype FROM mybb_google_seo WHERE active=1 AND ((idtype=4 AND id IN (14034)))

The plugin is here:
[Version dev. 0.1] TopPosts Plugin
#2
Not Solved
It's a host issue as indicated by the error message.
No longer involved in the MyBB project.
#3
Not Solved
Raise your max_allowed_packet , default should be at 8. You can try raising it to 32.
#4
Not Solved
Normally I have sometimes more than 200 cuncurrent users on my forum simultaneoulsy. When I enabled my plugin it was at 5am and I had only 5 users. This plugin is called only during the index page rendering, which I believe I was the only user activating it at the time. I'm saying this because it doesn't seem like it would have anything different at the server that would have cause this error.

Would someone more experienced be able to test my plugin?

On phpmyadmin, it shows max allowed packet as 67,108,864
http://community.mybb.com/thread-139455.html

Also, my plugin doesn't do any insert or updates to the database.
#5
Not Solved
I made some changes to the plugin, and now I run it using a separated task. Again, it works locally, in the server it shows the error below. One of the messages mention "Permission denied". but the folders where the plugin sabe the temporary image and the final destination of the thumnails have 777 permissions.

Quote:Warning [2] curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set - Line: 1061 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/topposts.php 1061 curl_setopt
/inc/plugins/topposts.php 998 downloadFile
/inc/plugins/topposts.php 949 tp_createThumb
/inc/plugins/topposts.php 643 tp_GetThreadImage
/inc/plugins/topposts.php 776 tp_GetNewestPosts
/inc/plugins/topposts.php 95 tp_UpdateContent
[PHP] topposts_activate
/admin/modules/config/plugins.php 394 call_user_func
/admin/index.php 523 require
HTTP/1.1 200 OK Server: Apache Last-Modified: Wed, 08 May 2013 13:09:28 GMT ETag: "258d6287-1595-4dc34a4cab200" X-UA-Compatible: IE=EmulateIE7 Content-Type: image/jpeg X-Backend: renders_nova_node_01 X-Url: /fotos/policia_civil_288(3).jpg X-Varnish: 600586563 X-Varnish-ID: 43 Content-Length: 5525 Cache-Control: max-age=432000 Expires: Thu, 23 May 2013 08:18:26 GMT Date: Sat, 18 May 2013 08:18:26 GMT Connection: keep-alive
Warning [2] fopen(/home/user/antinovaordemmundial.com/mybb/inc\plugins\topposts\temp\thumb_13986.jpg) [function.fopen]: failed to open stream: Permission denied - Line: 1078 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/topposts.php 1078 fopen
/inc/plugins/topposts.php 998 downloadFile
/inc/plugins/topposts.php 949 tp_createThumb
/inc/plugins/topposts.php 643 tp_GetThreadImage
/inc/plugins/topposts.php 776 tp_GetNewestPosts
/inc/plugins/topposts.php 95 tp_UpdateContent
[PHP] topposts_activate
/admin/modules/config/plugins.php 394 call_user_func
/admin/index.php 523 require
Warning [2] curl_setopt(): supplied argument is not a valid File-Handle resource - Line: 1079 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/topposts.php 1079 curl_setopt
/inc/plugins/topposts.php 998 downloadFile
/inc/plugins/topposts.php 949 tp_createThumb
/inc/plugins/topposts.php 643 tp_GetThreadImage
/inc/plugins/topposts.php 776 tp_GetNewestPosts
/inc/plugins/topposts.php 95 tp_UpdateContent
[PHP] topposts_activate
/admin/modules/config/plugins.php 394 call_user_func
/admin/index.php 523 require
Warning [2] fclose(): supplied argument is not a valid stream resource - Line: 1081 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/topposts.php 1081 fclose
/inc/plugins/topposts.php 998 downloadFile
/inc/plugins/topposts.php 949 tp_createThumb
/inc/plugins/topposts.php 643 tp_GetThreadImage
/inc/plugins/topposts.php 776 tp_GetNewestPosts
/inc/plugins/topposts.php 95 tp_UpdateContent
[PHP] topposts_activate
/admin/modules/config/plugins.php 394 call_user_func
/admin/index.php 523 require
Warning [2] exif_imagetype(/home/user/antinovaordemmundial.com/mybb/inc\plugins\topposts\temp\thumb_13986.jpg) [function.exif-imagetype]: failed to open stream: No such file or directory - Line: 1082 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/topposts.php 1082 exif_imagetype
/inc/plugins/topposts.php 998 downloadFile
/inc/plugins/topposts.php 949 tp_createThumb
/inc/plugins/topposts.php 643 tp_GetThreadImage
/inc/plugins/topposts.php 776 tp_GetNewestPosts
/inc/plugins/topposts.php 95 tp_UpdateContent
[PHP] topposts_activate
/admin/modules/config/plugins.php 394 call_user_func
/admin/index.php 523 require
Warning [2] unlink(/home/user/antinovaordemmundial.com/mybb/inc\plugins\topposts\temp\thumb_13986.jpg) [function.unlink]: No such file or directory - Line: 1090 - File: inc/plugins/topposts.php PHP 5.2.17 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/topposts.php 1090 unlink
/inc/plugins/topposts.php 998 downloadFile
/inc/plugins/topposts.php 949 tp_createThumb
/inc/plugins/topposts.php 643 tp_GetThreadImage
/inc/plugins/topposts.php 776 tp_GetNewestPosts
/inc/plugins/topposts.php 95 tp_UpdateContent
[PHP] topposts_activate
/admin/modules/config/plugins.php 394 call_user_func
/admin/index.php 523 require
MyBB SQL Error
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
2006 - MySQL server has gone away
Query:
SELECT t.tid, p.subject, p.message FROM mybb_threads t, mybb_posts p where t.tid=13788 and t.firstpost=p.pid
#6
Not Solved
Fixed the permissions problem.

Before, my function that downloads and resizes the images where called in a loop that were reading each of the lines in a resultset. I thought that might be the problem and I changed so that the entire result set is loaded into an array (I will have at most 20 lines). Then I iterate through that array to create my plugin html.

Still, I am having the same problem with a secong sql, the one that reads the content of the first post to search for images in it.

The function that does that looks like this:

Quote:function tp_GetThreadImageUrl($tid){
global $mybb, $db;

$query = $db->query ("
SELECT t.tid, p.subject, p.message FROM mybb_threads t, mybb_posts p
where t.tid=".$tid." and t.firstpost=p.pid");
$post = $db->fetch_array($query);
$message=$post["message"];

//try to locate the first image on the post text
preg_match_all("#(?P<wholestring>\[img\](\r\n?|\n?)(?P<url>https?://([^<>\"']+?))\[/img\])#ise", $message, $matches);

// No match? Let's skip this loop around
if (empty($matches) OR !is_array($matches) OR !isset($matches['wholestring']) OR !isset($matches['url'])) {
//if it doesn't find it returns default image
return;
}

foreach ($matches['url'] as $match) {
return $match;
}
}

Quote:MyBB SQL Error
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
2006 - MySQL server has gone away
Query:
SELECT t.tid, p.subject, p.message FROM mybb_threads t, mybb_posts p where t.tid=14150 and t.firstpost=p.pid

Just remembering that it works fine on my windows 7 + WAMP, and fails only on my server, which has a much better processing power.

If someone could try out my plugin to test on a linux server, it would be great. I am stuck at this and can't put in my live forum :/

The plugin can be downloaded from here:
http://forum.antinovaordemmundial.com/im...Plugin.zip


Forum Jump:


Users browsing this thread: 1 Guest(s)