{"id":6993661,"date":"2016-01-27T10:52:31","date_gmt":"2016-01-27T10:52:31","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/constant-500-server-errors\/"},"modified":"2016-08-31T00:57:01","modified_gmt":"2016-08-31T00:57:01","slug":"constant-500-server-errors","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/constant-500-server-errors\/","title":{"rendered":"Constant 500 Server Errors"},"content":{"rendered":"<p>I can&#8217;t seem to make this plugin work, and I can&#8217;t seem to find any similar support issues\/discussions. In addition, it seems this particular plugin gets very little replies when people have problems, so I am shooting in the dark and hoping for something&#8230;<\/p>\n<p>I have a configuration like this:<br \/>\n1. Load balancer using tcp balancing<br \/>\n2. 3 application servers (ubuntu 14.04, php7.0-fpm, etc.)<br \/>\n3. 1 Master Percona(MySQL 5.6)<br \/>\n4. 1 Slave Percona(MySQL 5.6)<\/p>\n<p>Slave server is configured to replicate from master, and it is working perfectly as expected.<\/p>\n<p>My load balancer works perfectly to balance traffic among the 3 app servers. All three app servers can connect to the database servers without issue. I have manually tested via terminal from all three app servers.<\/p>\n<p>App servers have a Read\/Write user that can connect to the Master DB server. App servers have a Read-Only user that can connect to the Slave DB server.<\/p>\n<p>I have WordPress 4.4.1 running on the app servers using Gluster and the site is working perfectly, as long as I only connect with the Master DB. It is when I try to add HyperDB and distribute reads\/writes to their appropriate DB that problems arise. <\/p>\n<p>My wp-config defines the master DB host and slave DB host. It also defines the users and their respective passwords. I have tried the following scenarios:<\/p>\n<p>1. Use only 1 username\/pw combo for both db servers with full privileges<br \/>\n2. Use 2 username\/pw combos for each server (which i truly want because readonly has read only access to the particular db)<\/p>\n<p>I have tried configuring the hosts using their hostname (properly set in \/etc\/hosts on all servers and tested multiple times to ensure no networking issues).<\/p>\n<p>I have tried configuring the hosts using their private IP addresses, and even port 3306, just in case that was an issue.<\/p>\n<p>I have tried even using only the master db server as both the read\/write and the read-only server. I have tried using the slave db server as the read\/write and read-only server (making sure to restore all db back to sync with master so we are not out of sync or having corrupt tables).<\/p>\n<p>Here is my experience:<\/p>\n<p>1. When I run the WordPress site using normal setup (standard config and only 1 db connection) everything works perfectly. Can browse the site, can edit\/save pages and posts, can install, delete plugins, etc. Everything works 100% as expected. Whether I connect to the Master or Slave DB server.<\/p>\n<p>2. When I add db.php to the \/wp-content folder to activate HyperDB, I get 2 outcomes:<br \/>\n     a. Either I can see the static homepage with out-of-date information, but when I try to access \/wp-admin I get 500 server error<br \/>\n     b. I get 500 server error on all pages<\/p>\n<p>I have tried to define the hosts in db-config.php with many settings. Currently it is:<\/p>\n<p>$wpdb-&gt;add_database(array(<br \/>\n&#8216;host&#8217; =&gt; &#8216;xxx.xxx.xxx.xx&#8217;,<br \/>\n&#8216;user&#8217; =&gt; &#8216;user&#8217;,<br \/>\n&#8216;password&#8217; =&gt; &#8216;password&#8217;,<br \/>\n&#8216;name&#8217; =&gt; &#8216;db-name&#8217;,<br \/>\n&#8216;write&#8217; =&gt; 1,<br \/>\n&#8216;read&#8217; =&gt; 1,<\/p>\n<p>));<\/p>\n<p>$wpdb-&gt;add_database(array(<br \/>\n&#8216;host&#8217; =&gt; &#8216;xxx.xxx.xxx.xx&#8217;,<br \/>\n&#8216;user&#8217; =&gt; &#8216;user&#8217;,<br \/>\n&#8216;password&#8217; =&gt; &#8216;password&#8217;,<br \/>\n&#8216;name&#8217; =&gt; &#8216;db-name&#8217;,<br \/>\n&#8216;write&#8217; =&gt; 0,<br \/>\n&#8216;read&#8217; =&gt; 1,<br \/>\n));<\/p>\n<p>*note &#8211; I have omitted the ip addresses, username, pw, and db-name to protect the security of our system. They are correctly in the file. At present trying to hard-code them to db-config to override wp-config. I have also tried setting them as variables and then defining them in wp-config.<\/p>\n<p>No matter what I do, how much I check connections, networking, wp-config, db-config, caching setting, etc. NOTHING WORKS. All I get is 500 server errors from HyperDB.<\/p>\n<p>Any ideas?<\/p>\n<p>https:\/\/wordpress.org\/plugins\/hyperdb\/<\/p>\n","protected":false},"template":"","class_list":["post-6993661","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6993661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6993661\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6993661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}