I have a Laravel project that should be deployed on Linux machine and served by Nginx.
It runs on PHP 7.4
I cloned project from Git, install vendor packages, and changed .env file for application desired state.
But when I try to access website, I got an error:
Fatal error: Uncaught Error: Call to undefined method
Fatal error: Uncaught Error: Call to undefined method ComposerAutoloaderInit90740c17631bd3f3e829063649c6f6e0::getLoader()
There is my autoload.php content:
<?php
// autoload.php #generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit90740c17631bd3f3e829063649c6f6e0::getLoader();
I have already tried almost every solution in the internet. But none of them solved my problem.
I just wanna know that it's server-side error or application-side error?
Related
I have Magento 2.3 and I want to use Magento Functional Testing Framework version 2.3 but when I run the command vendor/bin/mftf run:test AdminLoginTest to run the test, the following error occurs:
==== Redirecting to Composer-installed version in vendor/codeception ====
Fatal error: Uncaught Error: Call to undefined function Codeception\Lib\codecept_absolute_path() in /Users/hanhan/Deskto
p/workspace/magento2/vendor/codeception/codeception/src/Codeception/Lib/ParamsLoader.php:25
In the file PramsLoader.php, codecept_absolute_path() method is invoked and it gives the error because this method is not defined
$this->paramsFile = codecept_absolute_path($paramStorage);
How can i solve this ?
I happened to encounter the same error today. It's because there is an old vendor directory in dev/tests/acceptance where previously we store composer.json file and now moved to root. Deleting dev/tests/acceptance/vendor folder resolve the fatal error.
I have installed Stripe API using php composer on my website which is currently using Magento 2.2. I ran "composer require stripe/stripe-php", which installed all the correct files.
However, on the checkout page on my website, I am receiving an error:
Fatal error: Uncaught Error: Class 'Stripe\Stripe' not found in /home/collamod/public_html/app/code/Webkul/MpStripe/Model/PaymentMethod.php:174 Stack trace: #0 /home/collamod/public_html/generated/code/Webkul/MpStripe/Model/PaymentMethod/Interceptor.php(24): Webkul\MpStripe\Model\PaymentMethod->initializeStripe('sk_live_hGgIuYd...') #1 /home/collamod/public_html/app/code/Webkul/MpStripe/Model/PaymentMethod.php(164): Webkul\MpStripe\Model\PaymentMethod\Interceptor->initializeStripe('sk_live_hGgIuYd...') #2 /home/collamod/public_html/generated/code/Webkul/MpStripe/Model/PaymentMethod/Interceptor.php(14): Webkul\MpStripe\Model\PaymentMethod->__construct(Object(Magento\Framework\Model\Context), Object(Magento\Framework\Registry), Object(Magento\Framework\Api\ExtensionAttributesFactory), Object(Magento\Framework\Api\AttributeValueFactory), Object(Magento\Payment\Helper\Data), Object(Magento\Framework\App\Config), Object(Magento\Payment\Model\Method\Logger), Object(Webkul\MpStripe\Helper\Data), Object(Webkul\Marketplace\Helper\ in /home/collamod/public_html/app/code/Webkul/MpStripe/Model/PaymentMethod.php on line 174
My composer.json file has the appropriate lines required:
"require": {
"magento/product-community-edition": "2.2.1",
"composer/composer": "#alpha",
"mage2pro/stripe": "*",
"stripe/stripe-php": "^5.7"
},
On Line 174 in PaymentMethod.php as the error indicates, the code is:
public function initializeStripe($stripeKey = false)
{
if ($stripeKey) {
if ($this->getDebugFlag()) {
\Stripe\Stripe::setApiKey($stripeKey);
} else {
\Stripe\Stripe::setApiKey($stripeKey);
}
} else {
return false;
}
}
What could be the reason for this? Any insight would be kindly appreciated! Thank you!
Raymond Z.
Please run this command
composer require stripe/stripe-php
I'm having this error:
( ! ) Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Professor/Controller/WebinarController' in /uov-videos/www/david/plataovirtual/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 526
This happens when I'm trying to use:
$app = Zend\Mvc\Application::init(require 'config/application.config.php');
$application = $app->getMvcEvent()->getApplication();
$sm = $application->getServiceManager();
$webinar_controller = $sm->get('Professor/Controller/WebinarController');
In a routine outside the original project.
Any suggestions?
Try to run a composer update and/or composer install ;)
I had the same problem, configure your PHP version is compatible
I was installing slim 3 according to Slim Documentation.After installing i have created index.php file.Given below:
index.php:
<?php
require 'vendor/autoload.php';
$app = new Slim\App();
$app->get('/hello/{name}', function ($request, $response, $args) {
$response->write("Hello, " . $args['name']);
return $response;
});
$app->run();
But when i run the application in http://localhost:8000 then i get a fatal error.I have searched and get some solution in stackoverflow.Those are:
PHP Fatal error: Class 'Slim' not found - Slim Framework 3
PHP Fatal error: Class 'Slim' not found
Composer autoloader + slim framework - fatal error: Class 'Slim\Slim' not found?
But those solution does not solve my problem.Have any specific solution of it?
ERROR:
Fatal error: Class 'Slim\App' not found in
C:\xampp\htdocs\api\index.php on line 5
And my directory format:
UPDATED:
vendor/autoload.php:
<?php
// autoload.php #generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit98cfb2e091de2f633f87c81d16402aec::getLoader();
vendor forlder:
The problem is that you have downloaded and extracted Slim manually into htdocs\api\Slim.
It wasn't fetched by Composer, then it would reside in the vendor folder (vendor/slim/slim) and the autoload would work automatically.
Add Slim to your composer.json and run composer install again:
{
"require": {
"slim/slim": "^3.0"
}
}
You already require the Composer Autoloader, so the depenendency should be found and loaded after it was fetched.
Referencing: http://docs.slimframework.com/start/get-started/
i'm trying to use phpunit with zendframework and i'm follwing the tutorial in
https://media.readthedocs.org/pdf/zf2/latest/zf2.pdfhere is my
bootstrap.php
<?php
chdir(dirname(__DIR__));
include __DIR__ . '/../init_autoloader.php';
here is my IndexControllerTest.php
<?php
namespace ApplicationTest\Controller;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class IndexControllerTest extends AbstractHttpControllerTestCase
{
public function setUp()
{
$this->setApplicationConfig(
include '/C:/wamp/www/zf2/config/application.config.php'
);
parent::setUp();
}
public function testIndexActionCanBeAccessed()
{
$this->dispatch('/'); // this is line 20
$this->assertResponseStatusCode(200);
$this->assertModule('application');
$this->assertControllerName('application_index');
$this->assertControllerClass('IndexController');
$this->assertMatchedRouteName('home');
}
}
and i'm getting the follwing errors
Warning: include(C:\wamp\www\zf2\module\Application\test/../init_autoloader.php)
: failed to open stream: No such file or directory in C:\wamp\www\zf2\module\App
lication\test\Bootstrap.php on line 4
Fatal error: Class 'Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase'
not found in C:\wamp\www\zf2\module\Application\test\ApplicationTest\Controller
\IndexControllerTest.php on line 8
i think that's a path probleme (auloading)but i don't know how to fix
any one can help me please ?
Warning: include(C:\wamp\www\zf2\module\Application\test/../init_autoloader.php)
: failed to open stream: No such file or directory in C:\wamp\www\zf2\module\App
lication\test\Bootstrap.php on line 4
This warning is telling you that it can't find the location of your init_autoloader.php file. Assuming that file is located in the root of your ZF2 project (so C:\wamp\www\zf2) as is convention, you need to change:
include __DIR__ . '/../init_autoloader.php';
to
include __DIR__ . '/../../../init_autoloader.php';
EDIT Continued...
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to
load ZF2. Run php composer.phar install or define a ZF2_PATH environment
variable.' in C:\wamp\www\zf2\init_autoloader.php:48
Your init_autloader.php file is having trouble finding your ZF2 library autoloader. As you're using composer. Add
"zendframework/zendframework": "2.1.*",
to your "require" section in composer.json if its not already there. Run composer and update your vendor libraries with
php composer.phar update
Try run the application again and see if it works. It may do depending what is included in your init_autoload.php file. If you're still having problems add the following to init_autoloader.php
if(file_exists('vendor/autoload.php'))
{
$loader = require 'vendor/autoload.php';
}
Here's the Fix for the fatal error.
You must be missing the 'zend-test' package in your application.
$ composer require zendframework/zend-test