We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17930
    • 81 Posts
    Okay so I updated to 2.3.6 because I was having issues with my restore and it seems to be working. Now I'm trying to upgrade the PHP and I get 500 Error when I do.

    I got this error log, but not sure if it helps.

    [2015-09-18 01:04:44] (ERROR in xPDOConnection::connect @ /home2/weeeeeeee/public_html/core/xpdo/xpdo.class.php : 3046) SQLSTATE[HY000] [2019] Can't initialize character set  (path: /usr/share/percona-server/charsets/)
    [2015-09-18 01:04:44] (ERROR in xPDOConnection::connect @ /home2/weeeeeeee/public_html/core/xpdo/xpdo.class.php : 3046) SQLSTATE[HY000] [2019] Can't initialize character set  (path: /usr/share/percona-server/charsets/)
    [2015-09-18 01:04:44] (ERROR @ /index.php) Error preparing statement for query: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `zz_system_settings` AS `modSystemSetting`  - 
    [2015-09-18 01:04:44] (ERROR in xPDOConnection::connect @ /home2/weeeeeeee/public_html/core/xpdo/xpdo.class.php : 3046) SQLSTATE[HY000] [2019] Can't initialize character set  (path: /usr/share/percona-server/charsets/)
    [2015-09-18 01:04:44] (ERROR in xPDOConnection::connect @ /home2/weeeeeeee/public_html/core/xpdo/xpdo.class.php : 3046) SQLSTATE[HY000] [2019] Can't initialize character set  (path: /usr/share/percona-server/charsets/)
    [2015-09-18 01:04:44] (ERROR @ /index.php) Error preparing statement for query: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `zz_system_settings` AS `modSystemSetting`  - 
    [2015-09-18 01:04:44] (FATAL) Could not load core MODX configuration!
      • 17930
      • 81 Posts
      The entire site broke. Meaning even just trying to go to mysite.com/manager showed the 500 Error.
      • Just upgrading your PHP can cause a problem if the version of the MySQL client it has is too far off from the version of MySQL it's trying to connect to.

        Right now, my basic MAMP platform is using PHP 5.6.10, MySQL 5.5.42 with its default charset and collation set to UTF-8 Unicode. The MySQL client that PHP is using is 5.0.11.

        For MODX, the important bits are in the core/config/config.inc.php, in the top part that deals with the database connection, especially the lines for the $database_connection_charset and the $database_dsn.
          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
          • 17930
          • 81 Posts
          The MySql and MySql client version is: 5.5.42-37.1 - Percona Server (GPL), Release 37.1, Revision 727

          Not sure if this matters but here is some more info:
          cpsrvd 11.48.4.6
          Database client version: libmysql - 5.1.73
          PHP extension: mysqli

          Here are my $database_connection_charset and the $database_dsn settings. Should they be something else?
          $database_connection_charset = '';
          $database_dsn = 'mysql:host=localhost;dbname=blahblah_main_modx;charset=';


          Thank you so very much for helping guys!
          • discuss.answer
            • 3749
            • 24,544 Posts
            It should be:

            $database_dsn = 'mysql:host=localhost;dbname=whatever;charset=utf8';


            (assuming that your DB is in utf8)

            Check the lines above that to make sure you see:

            $database_connection_charset = 'utf8';


            and that the database username and password are correct.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • Quote from: mafokken at Sep 17, 2015, 05:44 AM
              Would this be caused by the fact I'm still on PHP 5.2.17? I tried to change the PHP version to use on cpanel and then when I did, my site broke. The only page I could see correctly was mysite.com. Mysite.com/blog was very weird.

              Just to confirm, yes that could definitely be the reason - MODX 2.4 requires PHP 5.3 and the package manager is one of the areas that can break if you're on an older version. There should have been a configuration warning about that on the dashboard too wink
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • discuss.answer
                • 17930
                • 81 Posts
                Wow. What a doozy. It was a combination of a lot of things. I finally got the php updated And the core directory moved. And the site not broken.

                Part of it was the $database_connection_charset and the $database_dsn settings. Thank you BobRay and Sottwell. Not sure why those weren't set correctly. But maybe I had overwritten the file with another version of the file with those variables set wrong.

                Got it working with 2.3.6 modx and php 5.4.43. When I'm sure it's fixed for good, I'll update to 2.4! smiley