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!

Tags: , , , ,

18 Responses to “Joomla: “Error loading Modules””

  1. Daniel Allen Says:

    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.

  2. admin Says:

    Nice to see someone finding this post useful :)

  3. Mohammed Says:

    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

  4. Sharif Says:

    Thank you soo mery much. I was pulling out my hair on this one.

  5. KattyBlackyard Says:

    Hi, very nice post. I have been wonder’n bout this issue,so thanks for posting

  6. I AM Says:

    THANK YOU GOD!

  7. Scitek Says:

    Really… this is very useful, I spend a lot of time trying ways to solve this problem, so… u r the man!

  8. QuickLearner Says:

    Awesome stuff. Was breaking my head over it for half a day atleast :)

  9. Satish babu Says:

    Thanks Buddy saved my time

  10. DFUSED Says:

    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.

  11. jglass Says:

    just wanted to add my thanks - this was driving me crazy!

  12. pholcomb Says:

    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.

  13. Buckwheatpie Says:

    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!

  14. CMK Says:

    why didn’t I Google sooner….thanks :-)

  15. Rowena Says:

    Oh thankyou so much. You are a guru. :o)

  16. Brian Says:

    Very nice and much appreciated. Another reason why open source is so great; the people who use it are so generous.

  17. seraphim Says:

    Thank you very much. It worked immediately and saved a lot of time.

  18. Javier Says:

    thanks a lot man, for sharing this information.. Saved a lot of hours of research and headache… Thanks again!!

Leave a Reply