P2 theme can't connect to server

On newly installed non-multisite, I get “whoops, looks like you are not connected to server…”, when trying to update status, using the P2 theme. This was working until I installed WP Better Security and changed my DB table prefix.

When I first had WP BS change the prefix, I was thrown all the way back to the install page, but then I manually changed the default table prefix in wp-config.php. This enabled the site to run. All looked good until I tried to post. So there still seems to be a connected issue.

We are running this install on an Amazon EC3, so there is some tighter security/setup than I am used to, so I’m pretty sure it has something to do with permissions, and with the basic things that the WP BS plugin does when “securing site from basic attacks”.

I feel like it may have something to do with the .htaccess but I don’t know where to start.

Thanks for help.

  • Vaughan
    • Ex Staff

    hiya

    thanks for posting

    that error sounds more like the DB host is incorrect or the credentials are wrong.

    but then it could be other issues, i haven’t used WP BS but it isn’t a plugin you should really use lightly as, well it can break the site, as you have found out.

    can you post a copy of your wp-config.php & htaccess

    thanks.

  • rocannon
    • WPMU DEV Initiate

    if the credentials were wrong, wouldn’t the whole site give me “database connection error”? I’ve pasted both files below, but haven’t put in the actual db name,user,pw,or dbtable prefix, for security. Let me know if you really need those ids in order to troubleshoot. thank you Vaughan

    wp-config.php

    <?php
    /**
    * The base configurations of the WordPress.
    *
    * This file has the following configurations: MySQL settings, Table Prefix,
    * Secret Keys, WordPress Language, and ABSPATH. You can find more information
    * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
    * wp-config.php} Codex page. You can get the MySQL settings from your web host.
    *
    * This file is used by the wp-config.php creation script during the
    * installation. You don't have to use the web site, you can just copy this file
    * to "wp-config.php" and fill in the values.
    *
    * @package WordPress
    */

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'its-a-secret');

    /** MySQL database username */
    define('DB_USER', 'its-a-secret');

    /** MySQL database password */
    define('DB_PASSWORD', 'its-a-secret');

    /** MySQL hostname */
    define('DB_HOST', 'localhost');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    /**#@+
    * Authentication Unique Keys and Salts.
    *
    * Change these to different unique phrases!
    * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
    * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
    *
    * @since 2.6.0
    */
    define('AUTH_KEY', 'put your unique phrase here');
    define('SECURE_AUTH_KEY', 'put your unique phrase here');
    define('LOGGED_IN_KEY', 'put your unique phrase here');
    define('NONCE_KEY', 'put your unique phrase here');
    define('AUTH_SALT', 'put your unique phrase here');
    define('SECURE_AUTH_SALT', 'put your unique phrase here');
    define('LOGGED_IN_SALT', 'put your unique phrase here');
    define('NONCE_SALT', 'put your unique phrase here');

    /**#@-*/

    /**
    * WordPress Database Table prefix.
    *
    * You can have multiple installations in one database if you give each a unique
    * prefix. Only numbers, letters, and underscores please!
    */
    $table_prefix = 'its-a-secret';

    /**
    * WordPress Localized Language, defaults to English.
    *
    * Change this to localize WordPress. A corresponding MO file for the chosen
    * language must be installed to wp-content/languages. For example, install
    * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
    * language support.
    */
    define('WPLANG', '');

    /**
    * For developers: WordPress debugging mode.
    *
    * Change this to true to enable the display of notices during development.
    * It is strongly recommended that plugin and theme developers use WP_DEBUG
    * in their development environments.
    */
    define('WP_DEBUG', false);

    /* That's all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    .htaccess

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
    RewriteRule . index.php [L]

  • Vaughan
    • Ex Staff

    hiya

    just had a chat with a colleague. are you sure that htaccess is correct as it looks like a multisite htaccess not a single site.

    single site htaccess looks like

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    also can you check that the posts table actually has the correct prefix to all the others?

    thanks

  • rocannon
    • WPMU DEV Initiate

    Hi Vaughan and Ari,

    Thanks for your help. No solution yet. I have deleted the plugin, re-named the theme, pasted the above .htaccess anew, reactivated the theme, and I get the same response: “whoops, look like you are not connected to the server”

    To be clear, the site looks fine, I can access the dashaboard, and I can still add new posts. I just can’t do anything from the P2 status box.

    any ideas?

    What other files/db would WP Better Security have changed? Am I missing a rename of a dbtable or prefix or something?

    thanks again

  • aristath
    • Recruit

    @rocannon

    This seems to be an issue with the P2 theme… You can take a look at these 2 posts, see if they help you figure it out:

    http://wordpress.org/support/topic/theme-p2-whoops-looks-like-you-are-not-connected-to-the-server?replies=8

    http://wordpress.org/support/topic/whoops-looks-like-you-are-not-connected-to-the-server-p2-could-not-connect-wit?replies=2

    I not, I would advise you to post a new issue on the P2 forums here: http://wordpress.org/support/theme/p2

    I hope that helps!

    Cheers,

    Ari.