Joomla: “Error loading Modules”
I’ve been playing with the generic and useless message generated by Joomla 1.5.8 : “Error loading Modules”
This problem appeared while using Jumi, a Joomla plugin enabling custom scripts and file inclusion into articles, to include a php script which performs several sql queries.
I used Joomla + Jumi for a long time, without any problem. Now that I’ve moved from a Godaddy Shared Hosting to a Godaddy Virtual Dedicated Server, this problem has appeared.
What the hell was causing that weird message? And why no modules were showing in my page?
After wasting lot of time googling, I realized something with the MySql connection wasn’t fine.
I tried modifying all settings in my.cnf with no luck, I rewrote the script, I reinstalled Jumi… Nothing!
Before giving up, I looked into the php.net manuals.
HEY, FOUND THE PROBLEM!
Mysql has a “weird” behaviour: if you open 100 connections to 100 different databases in the same server, MySql uses the same connection id for each connection!
So if you do
$db1 = mysql_connect($host, $user, $pass);
$db2 = mysql_connect($host, $user, $pass);
mysql_select_db(‘db1′, $db1);
mysql_select_db(‘db2′, $db2);
you get a race condition: only db2 is selected.
That’s why my modules didn’t show !
What to do?
My workaround to fix the “multiple connections problem” with MySql is the following:
$host1 = “localhost”;
$host2 = “127.0.0.1″;
$host3 = “127.0.0.1:3306″;
$host4 = “localhost:3306″;
$db1 = mysql_connect($host1, $user, $pass);
$db2 = mysql_connect($host2, $user, $pass);
$db3 = mysql_connect($host3, $user, $pass);
$db4 = mysql_connect($host4, $user, $pass);
Hope it helps!
Any comment is welcome!
References:
http://www.matteogiannone.com/blog/2009/11/joomla-1-5-error-loading-modules/ (Italian)
Tags: godaddy virtual dedicated server, Joomla, joomla modules, jumi, Mysql
April 26th, 2009 at 7:22 am
Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you!
OMG! You just saved me so much time and I thought I was going crazy!! I installed jumi and had the same problem and it only happened on the script calling another database. Everything worked great calling the php file directly, but through jumi it was kinda working. So I thought it was joomla and you had to connect to databases in a very specific way and I wasn’t getting anywhere with that. So I googled: “Error loading Modules:” jumi
And this page came up and you became my hero! I don’t know how you figured this out, but I would never have figured this out in a million years! Even if I had read the php.net manuals! So for me I used “localhost:3306″ and everything was working again! So thank you very much for A) figuring this out and B) for sharing the solution with the world.
April 26th, 2009 at 6:58 pm
Nice to see someone finding this post useful
June 8th, 2009 at 11:49 pm
Thanks you very much for the solution and the fact you share it…..I have the same problem and i tried a lot of ways without result…Now it’s OK Thanks you
June 11th, 2009 at 10:20 pm
Thank you soo mery much. I was pulling out my hair on this one.
June 15th, 2009 at 4:42 am
Hi, very nice post. I have been wonder’n bout this issue,so thanks for posting
June 24th, 2009 at 7:24 pm
THANK YOU GOD!
June 28th, 2009 at 11:20 pm
Really… this is very useful, I spend a lot of time trying ways to solve this problem, so… u r the man!
July 24th, 2009 at 5:42 pm
Awesome stuff. Was breaking my head over it for half a day atleast
August 7th, 2009 at 8:28 am
Thanks Buddy saved my time
August 21st, 2009 at 8:27 pm
holy smokes…. I’m yet another user that was battling this till I found your page. Then went DOH!…
Thanks so much. You ought to post some entries into reply to bump ranking in search engines.
September 17th, 2009 at 9:08 pm
just wanted to add my thanks – this was driving me crazy!
September 28th, 2009 at 6:49 pm
To follow everyone else’s words, “I think I love you”. Ha. I racked my brain for hours trying to figure this out. Thanks for the post.
October 1st, 2009 at 12:40 am
Hi, this is very helpful cos i’m having a similar problem – perhaps you can help? or anyone else reading this?
i have only called one DB connection, yet am still getting 17 “Error Loading Module” errors!
i’m a beginner, and i’m trying to use Jumi to bring a table of the titles of all the articles in a certain category to appear at the bottom of an article – my code (with HTML table bits stripped out for convenience) is:
[code]
[/code]
The list of articles in category 53 does appear underneath all the “Error loading module” messages…
any ideas? many thanks!
October 12th, 2009 at 1:16 pm
why didn’t I Google sooner….thanks
December 2nd, 2009 at 2:13 pm
Oh thankyou so much. You are a guru.
)
January 10th, 2010 at 5:54 pm
Very nice and much appreciated. Another reason why open source is so great; the people who use it are so generous.
January 28th, 2010 at 11:04 am
Thank you very much. It worked immediately and saved a lot of time.
March 1st, 2010 at 7:13 pm
thanks a lot man, for sharing this information.. Saved a lot of hours of research and headache… Thanks again!!
April 6th, 2010 at 2:08 pm
Same as everyone else. THANKS guy!! So much help!
April 7th, 2010 at 3:24 am
thank you so much, it is really helpful
May 30th, 2010 at 2:48 pm
I have also used your trick. Thanks.
September 2nd, 2010 at 10:12 am
Thank you.
great solution !!
September 9th, 2010 at 4:50 pm
omg thanks alot, i keep getting these errors even after turning off error reporting. The problem happens if I try to connect two different databases using the same database login information.
127.0.0.1 = localhost =lifesaver. Thanks!!
December 7th, 2010 at 10:54 pm
thanks a lot , you are the man of the game……..
So clever like you i would like to be in my dreams:)
Thanks again it was very, very helpful.
January 7th, 2011 at 5:10 am
amazing, that was fast!
thanks m8! you saved my dawn!
January 7th, 2011 at 9:45 am
@Buckwheatpie: hello. Did you find an answer to your problem? Because I have the same one.
January 24th, 2011 at 1:48 pm
$host1 = “localhost”;
$host2 = “127.0.0.1″;
$host3 = “127.0.0.1:3306″;
$host4 = “localhost:3306″;
$db1 = mysql_connect($host1, $user, $pass);
$db2 = mysql_connect($host2, $user, $pass);
$db3 = mysql_connect($host3, $user, $pass);
$db4 = mysql_connect($host4, $user, $pass);
where will i put this?
February 15th, 2011 at 11:02 am
Wow man.. You’re my hero too!! I had no clue how to make it work! You’re a genius!!
February 20th, 2011 at 12:23 pm
Thanks a million~!!!!!!!!!!!!!!!!!!!!!!!!
March 8th, 2011 at 12:56 am
Big help. Thanks for taking the time to write the solution.
July 4th, 2011 at 12:01 am
Yeah, yeah and Yeahhhhh!!!
Thanks a lot!
I am using Joomla with myTableEditor and this one was breaking my nerves due to database connections problems… Solved with your help. Many Thanks!!!
November 22nd, 2011 at 10:09 pm
I have the same question as LA .. where do you put this code?
$host1 = “localhost”;
$host2 = “127.0.0.1″;
$host3 = “127.0.0.1:3306″;
$host4 = “localhost:3306″;
$db1 = mysql_connect($host1, $user, $pass);
$db2 = mysql_connect($host2, $user, $pass);
$db3 = mysql_connect($host3, $user, $pass);
$db4 = mysql_connect($host4, $user, $pass);
November 23rd, 2011 at 12:43 pm
@LA and @Tosh :
those are alternative ways to open a connection to the mysql server: this code is inside the component/plugin causing problems.
February 15th, 2012 at 5:55 pm
And again Sir, thanks
If you are ever in Javea, Spain – I owe you several beers.
Even though I was only connecting once, to populate a content page with a database extract, I was getting several ‘Error…’ messages. The database extract itself would work lovely, but Joomla would not load any page stuff.
Simply adding :3306 to my mysql_connect(…) hostname solved the problem.
May 4th, 2013 at 10:40 am
THANK YOU very much for sharing this solution. I use phpinclude and had the same problem and spent 2 days before i found your solution. thanks again!