We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I'm getting frequent "permission denied" warnings in elements or files in the Tree. I also get frequent popup asking me to log in again. From the error log (lots and lots of these):
    [2012-07-10 11:50:04] (ERROR @ /connectors/element/index.php) Error preparing statement for query: SELECT `modSession`.`id` AS `modSession_id`, `modSession`.`access` AS `modSession_access`, `modSession`.`data` AS `modSession_data` FROM `modx_session` AS `modSession` WHERE `modSession`.`id` = ? -
    [2012-07-10 11:50:04] (ERROR in xPDOConnection::connect @ /opt/local/share/httpd/htdocs/core/xpdo/xpdo.class.php : 2997) SQLSTATE[HY000] [1040] Too many connections

    This is a VPS on a "cloud" implementation of an OpenSolaris clone.

    Revo: 2.2.4-pl
    Database version: 5.5.19
    mysql.allow_persistent: On
    mysql.max_links: unlimited
    mysql.max_persistent: 20

    This is a dev site, with no other access than my own development activity.

    Is this an issue with Revo requiring a lot of connections, or something odd about the server configuration? [ed. note: sottwell last edited this post 14 years, 2 months ago.]
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Two other servers (including my MAMP-based localhost installation and a Bluehost installation of 2.2.1) have the mysql.max_persistant set to "unlimited".
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 22303 MODX Staff
        • 10,725 Posts
        Since there are a lot of AJAX requests firing off simultaneously in many places in the manager, there are a lot of requests/connections needed to support the Revolution manager. That said, you are not using persistent connections, so each request is creating a new connection. You may want to try using persistent connections.

        In your core/config/config.inc.php file, there is a $driver_options array where you can add options for the PDO driver. To use persistent connections, which will reuse the connections among the same pool of 20 you are allocated, simply set the following driver attribute to true:

        $driver_options = array (
            PDO::ATTR_PERSISTENT => true
        );


        I'm assuming the problem is you are also being limited in the total number of connections you can have at once, so reusing the same 20 may help, or it may not.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          mysql.max_links: unlimited does what? I can't find any such setting in the MySQL documentation.

          This is taken from the Reports section of the Manager.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 22303 MODX Staff
            • 10,725 Posts
            IDK what max_links is, but check your mysql server variables to see what is set for max_connections. My localhost server is set to 151.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It is apparently a little complicated. In my.cnf it's set to 0, and it appears that a user setting is used to control the individual database value. Or something. I still don't quite have it all figured out. I'll get there eventually wink

              mysql.max_links is what is listed in the Reports -> System Info (taken from phpinfo, I presume)
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org