没有不值得去解决的问题,也没有不值得去学习的技术!

./yii 无输出的排查分析

参考网址:https://www.shuijingwanwq.com/2021/04/15/4859/ 。基于 Composer 更新 Yii 2 至最新版本,将 Yii Framework 从 2.0.35 版本升级到 2.0.41.1。./yii 无输出。

1、参考网址:https://www.shuijingwanwq.com/2021/04/15/4859/ 。基于 Composer 更新 Yii 2 至最新版本,将 Yii Framework 从 2.0.35 版本升级到 2.0.41.1。./yii 无输出。如图1

参考网址:https://www.shuijingwanwq.com/2021/04/15/4859/ 。基于 Composer 更新 Yii 2 至最新版本,将 Yii Framework 从 2.0.35 版本升级到 2.0.41.1。./yii 无输出。
图1

[root@api-78b4b688b4-l26vd ccp_api]# ./yii
[root@api-78b4b688b4-l26vd ccp_api]# 


2、./yii 有输出的正常情况。如图2

./yii 有输出的正常情况。
图2

3、编辑 ./yii 文件,有输出:0。如图3

编辑 ./yii 文件,有输出:0。
图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、编辑 ./yii 文件,无输出。可以确定与 /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、在本地环境中是正常的。如图4

在本地环境中是正常的。
图4

6、对比开发环境与本地环境,/vendor 的差异。因为 /vendor 是放在 Git 中的。chore:再次添加 /vendor。./yii 有输出。如图5

对比开发环境与本地环境,/vendor 的差异。因为 /vendor 是放在 Git 中的。chore:再次添加 /vendor。./yii 有输出。
图5

7、在另外一个工程中,即使按照如上的方式处理后,仍然无输出。如图6

在另外一个工程中,即使按照如上的方式处理后,仍然无输出。
图6

[root@api-6b9cd4ddb5-hcrks pcs_api]# ./yii
[root@api-6b9cd4ddb5-hcrks pcs_api]# 


8、删除 /vendor,删除 composer.lock,提交。添加 /vendor,添加 composer.lock,提交。./yii 有输出。如图7

删除 /vendor,删除 composer.lock,提交。添加 /vendor,添加 composer.lock,提交。./yii 有输出。
图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.


 

PHP / Laravel / Yii2 老项目维护与长期技术支持

如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。

适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护

可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查

如需咨询,请联系我,并注明:PHP 维护咨询

联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理