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

How to Resolve the “No input file specified.” Error in an LNMP Environment When the File Exists

How to Resolve the "No input file specified." Error in an LNMP Environment When the File Exists

1. http://wmpublish.mp.sztv.com.cn:8026/wx/robots.txt responded successfully, indicating that the Nginx configuration is correct.

Plaintext
User-agent: *
Disallow: /

2. http://wmpublish.mp.sztv.com.cn:8026/v1/channel-app-sources?group_id=channel failed to respond with “No input file specified.”

Plaintext
No input file specified.

3. Run a command inside the container to check the Nginx error logs, as shown in Figure 1

Figure 1
Bash
cat /var/log/nginx/error.log

Plaintext
2018/09/28 03:27:00 [error] 464#464: *225 FastCGI sent in stderr: "Unable to open primary script: /sobey/www/channel-pub-api/api/web/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.8.4, server: wmpublish.mp.sztv.com.cn, request: "GET /v1/channel-app-sources?filter[source_uuid]=27ba60d97ebc92f093502e4e12a37e7f&filter[status]=1&group_id=spider&filter[source]=spider HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wmpublish.mp.sztv.com.cn:8026"

4. Run a command inside the container to view the file contents; the file is found to exist, as shown in Figure 2.

Figure 2
Bash
cat /sobey/www/channel-pub-api/api/web/index.php

PHP
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
 
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
 
$config = yii\helpers\ArrayHelper::merge(
    require __DIR__ . '/../../common/config/main.php',
    require __DIR__ . '/../../common/config/main-local.php',
    require __DIR__ . '/../config/main.php',
    require __DIR__ . '/../config/main-local.php'
);
 
(new yii\web\Application($config))->run();

5. Run the command: ps -u nginx to display all processes running under the nginx user. Under normal circumstances (development environment), it should look like the following, as shown in Figure 3.

Figure 3
Bash
ps -u nginx

Plaintext
PID TTY          TIME CMD
477 ?        00:00:03 nginx
478 ?        00:00:05 nginx
479 ?        00:00:06 nginx
480 ?        00:00:04 nginx
4672 ?        00:00:00 php-fpm
4673 ?        00:00:00 php-fpm
4674 ?        00:00:00 php-fpm
4675 ?        00:00:00 php-fpm
4676 ?        00:00:00 php-fpm
4677 ?        00:00:00 php-fpm
4678 ?        00:00:00 php-fpm
4679 ?        00:00:00 php-fpm
4680 ?        00:00:00 php-fpm
4681 ?        00:00:00 php-fpm
4682 ?        00:00:00 php-fpm
4683 ?        00:00:00 php-fpm
4684 ?        00:00:00 php-fpm
4685 ?        00:00:00 php-fpm
4686 ?        00:00:00 php-fpm
4687 ?        00:00:00 php-fpm
4688 ?        00:00:00 php-fpm
4689 ?        00:00:00 php-fpm
4690 ?        00:00:00 php-fpm
4691 ?        00:00:00 php-fpm

6. Run the command: ps -u nginx to display all processes running under the nginx user. It turns out there are no php-fpm processes, as shown in Figure 4.

Figure 4
Bash
ps -u nginx

Plaintext
PID TTY          TIME CMD
463 ?        00:00:03 nginx
464 ?        00:00:05 nginx
465 ?        00:00:06 nginx
466 ?        00:00:04 nginx

7. Final analysis result: the root cause is that port 9000 was already occupied, causing php-fpm to fail to start. After stopping the service occupying port 9000, php-fpm started successfully. http://wmpublish.mp.sztv.com.cn:8026/v1/channel-app-sources?group_id=channel responded successfully.

Plaintext
10000 Successfully retrieved the list of application sources for the channel&lt;_links>http://wmpublish.mp.sztv.com.cn:8026/v1/channel-app-sources?group_id=channel&amp;per-page=1&amp;page=1&lt;_meta>0011


关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系