Error defining constants

0
 PHP Warning: include_once(): Failed opening '/classes/class.rslib.php' for inclusion (include_path='.;C:\php\pear\') in on line 26

I have logged this error in the log, debugged it and found the only file that does this include. When debugging everything worked correctly, but I still do not know the cause of the error.

Apparently at some point dirname(__FILE__) returned null. Is there an alternative to dirname(_FILE__) ?

        <?php       
    /*
     * Redsand Wordpress Library
     * Version: 2.1.4
     * Modify: 12/29/2014
     * Author: RedSand Team
     *
     */
    session_start();

    /// CONST //\
    define('RS_LIB_PATH', dirname(__FILE__));
    define('RS_LIB_URL', strpos(RS_LIB_PATH, 'wp-content/plugins') > 0 ? plugins_url('rslib', RS_LIB_PATH) : get_stylesheet_directory_uri() . '/rslib');

    define('RS_META_KEY_PREFIX', 'rs-');

    define('RS_NOT_SET', '__RS_NOT_SET__');

    define('LANGUAGES_PATH',  get_template_directory() . '/languages');

    define('RS_VERSION', '2.1.4');

    /// RS CLASS ///

    if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
        include_once(RS_LIB_PATH . '/classes/class.rslib.php');
        global $RS;
        $RS = new RS(); $RS->init();
    }
    else{
        wp_die('Sorry, Your site only run with PHP 5.3.0 or higher but current PHP version is '. PHP_VERSION . '.<br/>Please contact system administrator to upgrade it.');
    }
    
asked by anonymous 14.12.2017 / 16:28

1 answer

2

Try this:

define('RS_LIB_PATH', __DIR__);
    
14.12.2017 / 16:32