• Resolved tezalsec

    (@tezalsec)


    Hi, I am getting these warnings, but the cause is not clear to me. I get the basics of open_basedir restriction and its setting.

    What I don’t understand who is meddling with who here. Is MaxMind-DB-Reader meddling with Autoptimize, or is Autoptimize meddling with MaxMind-DB-Reader?

    Or does this just mean that Autoptimize has some scope issues with its files, which are triggered by MaxMind-DB-Reader’s class?

    Thanks for any insight.
    Cheers.

    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(autoptimizeScripts.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(autoptimizeBase.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(autoptimizeStyles.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(autoptimizeCSSmin.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(Autoptimize/tubalmartin/CssMin/Minifier.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(Autoptimize/tubalmartin/CssMin/Colors.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(Autoptimize/tubalmartin/CssMin/Utils.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(autoptimizeHTML.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(AO_Minify_HTML.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41
    [20-Jun-2022 12:52:56 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(RevSlider.php) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php on line 41

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmm .. weird .. so what is on line 41 of wp-content/plugins/my-plugin/lib/MaxMind-DB-Reader-php/autoload.php tezalsec ?

    Thread Starter tezalsec

    (@tezalsec)

    The function is a typical PSR-4 autoloader implementation for the MaxMind\DB namespace.

    function mmdb_autoload($class): void
    {
        /*
        * A project-specific mapping between the namespaces and where
        * they're located. By convention, we include the trailing
        * slashes. The one-element array here simply makes things easy
        * to extend in the future if (for example) the test classes
        * begin to use one another.
        */
        $namespace_map = ['MaxMind\\Db\\' => __DIR__ . '/src/MaxMind/Db/'];
    
        foreach ($namespace_map as $prefix => $dir) {
            // First swap out the namespace prefix with a directory...
            $path = str_replace($prefix, $dir, $class);
    
            // replace the namespace separator with a directory separator...
            $path = str_replace('\\', '/', $path);
    
            // and finally, add the PHP file extension to the result.
            $path = $path . '.php';
    
            // $path should now contain the path to a PHP file defining $class
            if (file_exists($path)) {
                include $path;
            }
        }
    }
    
    spl_autoload_register('mmdb_autoload');

    Line 41 is the one containing the file_exists function:

    ‘if (file_exists($path)) {‘

    I should add I am using an early loading mu-plugin phpfile containing the statement:
    ‘use MaxMind\Db\Reader’, making the class available to me there. The global scope from this class seems to interact with your plugin somehow..

    Thank you.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    very weird, I have no idea why that is happening I’m afraid (although my gut says it must be in the maxmind plugin somewhere), sorry .. :-/

    Thread Starter tezalsec

    (@tezalsec)

    thanks, weird indeed. I decided to hack and simplify the autoload file, and removed the file_exists check, now it is all fine.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    happy to read you were able to fix tezalsec ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Warnings file_exists(): open_basedir restriction in effect’ is closed to new replies.