Skip to content
Advertisement

PHP Fatal error: require(): Failed opening required lib prestashop

I have installed prestashop api lib in local (xampp) and works great, but when I upload the it to my server, it throws a exception.

Log file:

[16-Sep-2021 15:36:41 UTC] PHP Fatal error:  require(): Failed opening required '/intranet2/vendor/composer/../prestaShop/prestaShop-webservice-lib/PSWebServiceLibrary.php' (include_path='.:/opt/alt/php72/usr/share/pear') in intranet2/vendor/composer/autoload_real.php on line 71

autoload_files.php:

'10f21f9c238b52b8c49d198a6fc9e3be' => $vendorDir . '/prestaShop/prestaShop-webservice-lib/PSWebServiceLibrary.php',

composer_real.php:

<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit2e1450b2a266bcf5069d5539bf5e95dc
{
    private static $loader;

    public static function loadClassLoader($class)
    {
        if ('ComposerAutoloadClassLoader' === $class) {
            require __DIR__ . '/ClassLoader.php';
        }
    }

    /**
     * @return ComposerAutoloadClassLoader
     */
    public static function getLoader()
    {
        if (null !== self::$loader) {
            return self::$loader;
        }

        require __DIR__ . '/platform_check.php';

        spl_autoload_register(array('ComposerAutoloaderInit2e1450b2a266bcf5069d5539bf5e95dc', 'loadClassLoader'), true, true);
        self::$loader = $loader = new ComposerAutoloadClassLoader(dirname(dirname(__FILE__)));
        spl_autoload_unregister(array('ComposerAutoloaderInit2e1450b2a266bcf5069d5539bf5e95dc', 'loadClassLoader'));

        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
        if ($useStaticLoader) {
            require __DIR__ . '/autoload_static.php';

            call_user_func(ComposerAutoloadComposerStaticInit2e1450b2a266bcf5069d5539bf5e95dc::getInitializer($loader));
        } else {
            $map = require __DIR__ . '/autoload_namespaces.php';
            foreach ($map as $namespace => $path) {
                $loader->set($namespace, $path);
            }

            $map = require __DIR__ . '/autoload_psr4.php';
            foreach ($map as $namespace => $path) {
                $loader->setPsr4($namespace, $path);
            }

            $classMap = require __DIR__ . '/autoload_classmap.php';
            if ($classMap) {
                $loader->addClassMap($classMap);
            }
        }

        $loader->register(true);

        if ($useStaticLoader) {
            $includeFiles = ComposerAutoloadComposerStaticInit2e1450b2a266bcf5069d5539bf5e95dc::$files;
        } else {
            $includeFiles = require __DIR__ . '/autoload_files.php';
        }
        foreach ($includeFiles as $fileIdentifier => $file) {
            composerRequire2e1450b2a266bcf5069d5539bf5e95dc($fileIdentifier, $file);
        }

        return $loader;
    }
}

function composerRequire2e1450b2a266bcf5069d5539bf5e95dc($fileIdentifier, $file)
{
    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
        require $file;

        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    }
}

composer.json:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "prestashop/prestashop-webservice-lib": "dev-master"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "3.2.3",
        "beyondcode/laravel-dump-server": "^1.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "files": [
        "app/Http/Helpers/SessionHelper.php",
        "vendor/prestaShop/prestaShop-webservice-lib/PSWebServiceLibrary.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }

    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r "file_exists('.env') || copy('.env.example', '.env');""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

I supose that laravel doesn´t get correctly the lib but I don´t know how to fix it correctly. Please help, thx.

Advertisement

Answer

Composer is case sensitive, some letters´ path were different.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement