"Lnmp" prompt nginx PHP "No input file specified" error solution

Source: Internet
Author: User

Principle:

Any request for a. php file is simply given to php-cgi, but the PHP file is not verified to exist.

PHP file does not exist, there is no way to return a normal 404 error, it returns a 404, and with a sentence "No input file specified"

In addition, it may be related to a path or permission, or the script_filename variable is not set correctly (this is the most common reason for nginx).

Workaround:

1 Open File: Usr/local/php/etc/php.ini, modify the following configuration

    • Change Cgi.fix_pathinfo=0 to Cgi.fix_pathinfo=1
    • change the cgi.force_redirect=1 to cgi.force_redirect=0 .

2 Modifying file permissions

# cd/home/wwwroot# Chown-r www:www/*# chmod-r 755/*# lnmp Restart

When it's time to execute. If there are. user.ini files in individual projects. Will prompt

chown:changing ownership of './www.test.com/.user.ini ': Operation not permitted

This is the time to enter this directory to execute

Then go to the Wwwroot directory, then execute the permissions command, and finally do not forget to enter the Www.test.com directory, execute

Last reboot

LNMP restart

Get!

Add: Linux chattr command, used to change file properties.

This directive alters the file or directory attributes stored on the ext2 file system, which have the following 8 modes:

    1. A: Make the file or directory available for additional use only.
    2. B: Do not update the last access time of the file or directory.
    3. C: Compress the file or directory and store it.
    4. D: Exclude files or directories from dumping operations.
    5. I: Do not alter the file or directory arbitrarily.
    6. S: Privacy delete files or directories.
    7. S: Update files or directories instantly.
    8. U: Remove outside of prevention.
Grammar
Chattr [-rv][-v< Version number >][+/-/=< properties >][file or directory ...]
Parameters
    • -R recursively handles all files and subdirectories under the specified directory.
    • -v< version number > set file or directory version.
    • -V Displays the instruction execution process.
    • +< Properties > Open the Item property of the file or directory.
    • -< Properties > Close the Item property of the file or directory.
    • The =< property > Specifies the Item property of the file or directory.

Instance

Use the chattr command to prevent a key file in the system from being modified:

Chattr +i/etc/resolv.conf

/etc/resolv.  conf    

The following properties are displayed

----I--------/etc/resolv.conf

Allow a file to append data only to it, but not delete it, for various log files:

Chattr +a/var/log/messages

"Lnmp" Prompt for nginx PHP "No input file specified" error resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.