WordPress.org

Support

Support » Plugins and Hacks » Acunetix WP Security » wp-config.php location issue

wp-config.php location issue

  • Hi,

    I just noticed an issue with your code.

    You are referencing to wp-config.php using the following: ABSPATH.’wp-config.php’; and trailingslashit(ABSPATH).’wp-config.php’;

    This is creating issues when that file is not located in the root as allowed by wordpress that file can be one folder up…

    If you look in wordpress core file wp-load.php you can see they are using the following code which is more appropriate: if ( file_exists( ABSPATH . ‘wp-config.php’) ) {

    /** The config file resides in ABSPATH */
    require_once( ABSPATH . ‘wp-config.php’ );

    } elseif ( file_exists( dirname(ABSPATH) . ‘/wp-config.php’ ) && ! file_exists( dirname(ABSPATH) . ‘/wp-settings.php’ ) ) {

    /** The config file resides one level above ABSPATH but is not part of another install */
    require_once( dirname(ABSPATH) . ‘/wp-config.php’ );

    }

    Hope you can update you product soon

    Thanks a lot

    https://wordpress.org/plugins/wp-security-scan/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp-config.php location issue’ is closed to new replies.
Skip to toolbar