1. Reference URL: Updating Yii 2 to the latest version via Composer, upgrading Yii Framework from version 2.0.35 to 2.0.41.1. ./yii produces no output. See Figure 1.

[root@api-78b4b688b4-l26vd ccp_api]# ./yii
[root@api-78b4b688b4-l26vd ccp_api]#
2. The normal situation where ./yii produces output. See Figure 2.

3. Editing the ./yii file produces the output: 0. See Figure 3.

#!/usr/bin/env php
<?php
/**
* Yii console bootstrap file.
*/
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
echo 0;
exit;
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/common/config/bootstrap.php';
require __DIR__ . '/console/config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/common/config/main.php',
require __DIR__ . '/common/config/main-local.php',
require __DIR__ . '/console/config/main.php',
require __DIR__ . '/console/config/main-local.php'
);
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);
4. Editing the ./yii file results in no output. I can confirm that the issue is related to /vendor.
<?php
/**
* Yii console bootstrap file.
*/
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/vendor/autoload.php';
echo 1;
exit;
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/common/config/bootstrap.php';
require __DIR__ . '/console/config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/common/config/main.php',
require __DIR__ . '/common/config/main-local.php',
require __DIR__ . '/console/config/main.php',
require __DIR__ . '/console/config/main-local.php'
);
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);5. It works normally in the local environment. See Figure 4.

6. Comparing the /vendor directory between the development environment and the local environment. Because /vendor is tracked in Git. chore: add /vendor again. ./yii produces output. See Figure 5.

7. In another project, even after applying the above steps, there is still no output. See Figure 6.

[root@api-6b9cd4ddb5-hcrks pcs_api]# ./yii
[root@api-6b9cd4ddb5-hcrks pcs_api]#
8. Delete /vendor, delete composer.lock, and commit. Add /vendor, add composer.lock, and commit. ./yii produces output. See Figure 7.

[root@api-747859c976-7zj7g pcs_api]# ./yii
This is Yii version 2.0.41.1.
The following commands are available:
- asset Allows you to combine and compress your JavaScript and CSS files.
asset/compress (default) Combines and compresses the asset files according to the given configuration.
asset/template Creates template of configuration file for [[actionCompress]].
- cache Allows you to flush cache.
cache/flush Flushes given cache components.
cache/flush-all Flushes all caches registered in the system.
cache/flush-schema Clears DB schema cache for a given connection component.
cache/index (default) Lists the caches that can be flushed.
