Replies: 10 comments 4 replies
-
|
Can you please post the entire index.php, and the full stack, thanks. |
Beta Was this translation helpful? Give feedback.
-
index.php`<?php use Yiisoft\Yii\Runner\Http\HttpApplicationRunner; /**
// PHP built-in server routing. } require_once dirname(DIR,2) . '/app/autoload.php'; if (getenv('YII_ENV') === 'test') { // Run HTTP application runner ### stack in ***\vendor\yiisoft\di\src\Container.php:542 Stack trace: Message context: throwable: Yiisoft\Di\NotFoundException: No definition or class found or resolvable for "Psr\Log\LoggerInterface" while building "Yiisoft\ErrorHandler\ErrorHandler" -> "Psr\Log\LoggerInterface". in ***\vendor\yiisoft\di\src\Container.php:542 |
Beta Was this translation helpful? Give feedback.
-
|
Do you have this file? |
Beta Was this translation helpful? Give feedback.
-
|
yes , I have new ErrorHandler in index.php, it's ok, same problem, thanks $runner = new HttpApplicationRunner($rootPath, $_ENV['YII_DEBUG'], $_ENV['YII_ENV']); |
Beta Was this translation helpful? Give feedback.
-
|
yes , I have new ErrorHandler in index.php, it's ok, thanks |
Beta Was this translation helpful? Give feedback.
-
|
Could you share your repo? |
Beta Was this translation helpful? Give feedback.
-
|
the same with repo, without yiisoft/yii-debug |
Beta Was this translation helpful? Give feedback.
-
|
So let's roll from the scratch:
And we will see the following output: If it works for you and doesn't work from your app please share whole project as git repository. Just commit all files and push them to remote repository. |
Beta Was this translation helpful? Give feedback.
-
|
hi, I follow your advice, it's ok, then I move app/public to another place, error! <?php
declare(strict_types=1);
use Yiisoft\Yii\Runner\Http\HttpApplicationRunner;
use Yiisoft\Config\Config;
use Yiisoft\Config\ConfigPaths;
/**
* @psalm-var string $_SERVER['REQUEST_URI']
*/
// PHP built-in server routing.
if (PHP_SAPI === 'cli-server') {
// Serve static files as is.
/** @psalm-suppress MixedArgument */
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (is_file(__DIR__ . $path)) {
return false;
}
// Explicitly set for URLs with dot.
$_SERVER['SCRIPT_NAME'] = '/index.php';
}
// require_once dirname(__DIR__) . '/autoload.php';
require_once dirname(__DIR__,2) . '/app/autoload.php';
$rootPath = dirname(__DIR__,2).'/app';
$config = new Config(
new ConfigPaths($rootPath,'config','vendor'),
);
echo '3';
// Run HTTP application runner
$runner = new HttpApplicationRunner($rootPath, $_ENV['YII_DEBUG'], $_ENV['YII_ENV']);
// $runner->run();
$runner->withConfig($config)->run();log----------------------------------- Message context: |
Beta Was this translation helpful? Give feedback.
-
|
@fufudao try replace $config = new Config(
new ConfigPaths($rootPath,'config','vendor'),
);to $config = \Yiisoft\Yii\Runner\ConfigFactory::create(new ConfigPaths($rootPath,'config','vendor'), null);
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What steps will reproduce the problem?
modify vendor directory, then
in index.php
`$config = new Config(
new ConfigPaths($rootPath,'config','../vendor'),
);
// Run HTTP application runner
$runner = new HttpApplicationRunner($rootPath, $_ENV['YII_DEBUG'], $_ENV['YII_ENV']);
$runner->withConfig($config)->run();`
throwable: Yiisoft\Di\NotFoundException: No definition or class found or resolvable for "Psr\Log\LoggerInterface" while building "Yiisoft\ErrorHandler\ErrorHandler" -> "Psr\Log\LoggerInterface". in ****\vendor\yiisoft\di\src\Container.php:542
Stack trace:
#0 ****\vendor\yiisoft\di\src\Container.php(503): Yiisoft\Di\Container->buildInternal()
#1 ****\vendor\yiisoft\di\src\Container.php(153): Yiisoft\Di\Container->build()
#2 ****\vendor\yiisoft\yii-runner-http\src\HttpApplicationRunner.php(86): Yiisoft\Di\Container->get()
#3 ****\webroot\app\index.php(48): Yiisoft\Yii\Runner\Http\HttpApplicationRunner->run()
What is the expected result?
What do you get instead?
Additional info
Beta Was this translation helpful? Give feedback.
All reactions