./yii No output investigation and analysis
1. Reference URL:https://www.shuijingwanwq.com/en/2021/04/15/10238/. Updating Yii 2 to the latest version based on Composer, upgrade the Yii Framework from version 2.0.35 to 2.0.41.1. ./yii has no output. as shown in Figure 1
[root@api-78b4b688b4-l26vd ccp_api]# ./yii
[root@api-78b4b688b4-l26vd ccp_api]#
2. ./yii has the normal output of output. as shown in Figure 2
3. Edit the ./yii file, there is an output: 0. as shown in 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. Edit the ./yii file, no output. It can be determined that there is a relationship with /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 is normal in the local environment. as shown in Figure 4
6. Compare the difference between the development environment and the local environment, /vendor. Because /vendor is placed in git. Chore: Add /vendor again. ./yii has output. as shown in Figure 5
7. In another project, even after processing in the above manner, there is still no output. as shown in Figure 6
[root@api-6b9cd4ddb5-hcrks pcs_api]# ./yii
[root@api-6b9cd4ddb5-hcrks pcs_api]#
8. Delete /vendor, delete composer.lock, and submit. Add /vendor, add composer.lock, commit. ./yii has output. as shown in 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.






