No input file specified linux

Nginx + PHP — No input file specified.

Добрый вечер, Ребята и Девчата.

Начал изучать Nginx и столкнулся со следующей проблемой, установил LEMP и решил протестировать работу php. Но получаю следующею ошибку No input file specified. при переходе на свой тестовый сервер http://192.168.56.101/info.php .

Вот мой конфиг файл /etc/nginx/nginx.conf:

В гугле говорят мол из-за того, что нельзя прописывать root директорию в location, но у меня правильно сделано все, я явно ее указал в direct server , в общем голову сломал уже над задачей, помогите пожалуйста.

Вот еще файл на всякий мой /etc/php-fpm.d/www.conf:

Вроде этого должно быть достаточно:

Не помогает, вот вывод ошибки при таком раскладе:

Starting nginx: nginx: [emerg] open() «/etc/nginx/snippets/fastcgi-php.conf» failed (2: No such file or directory) in /etc/nginx/nginx.conf:35

Дистрибутив какой? Версия Nginx какая?

Хотя нет, мне лень разбираться. Положи вот это:

в файл /etc/nginx/snippets/fastcgi-php-full.conf и замени include snippets/fastcgi-php.conf; на include snippets/fastcgi-php-full.conf;

Спасибо, я думаю это поможет тоже, но я нашел ошибку. В процессе установки я ставил себе задачу научиться собирать Nginx через компиляцию необходимых мне модулей, библиотек и я пользовался вот этим вот гайдом Compile and Install Nginx.

Я как понял, то из-за того, что делал по гайду, то у меня Nginx запускается из под пользователя nginx и его home директория изменена — useradd -d /etc/nginx/ -s /sbin/nologin nginx , следовательно нету на лругие директории прав и он не может запустить обработчик. В общем, я директорию в /etc/nginx/test, положил туда мой скрипт и все заработало.

Прошу теперь мне помочь разобраться, как допустим пользователю nginx дать права на другие директории и нужно ли согласно гайда так делать. Можно ли пропустить этот шаг.

Что такое ты мучаешь, что тебе приходится писать «твой» конфиг? Какую-нибудь кали? Ставь убунту и не мучай жопу.

Я делаю все на CentOS7 и опыта у меня мало и конфиг файл пишу сам т.к. проще разобрать каждый контекст и директиву.

В этом есть какой-то сакральный смысл, или просто левая пятка захотела?

Да, кстати, вангую что у тебя не работает потому что нужно сделать

как в этой инструкции написано.

Ванга сегодня не зашла, я по этой делал инструкции)) И этот параметр выставлен и раскомменчен, в общем суть такая, у меня работает только если я создаю папки в /etc/nginx/. Если в любой другой типа /home/… то не работает. Тут дельный совет кто даст что чекнуть и что может влиять? Работаю под root.

В общем, как я и сказал, по тому гайду что я выше писал, для пользователя nginx домашний каталог изменен на /etc/nginx либо меняете в etc/passwd или оставляете, вот поэтому и не работало. Все, всем спасибо и пока!

В этом есть какой-то сакральный смысл, или просто левая пятка захотела?

Хочется человеку попердолиться на праздниках, тебе жалко что-ли?

Я не очень понял чего ты хочешь добиться, но на всякий случай замечу что в большинстве случаев не стоит держать в /home что-то связанное с nginx или другим подобным софтом. /home это для домашних директорий пользователей, тех которые из мяса и прочей требухи

не стоит держать в /home что-то связанное с nginx или другим подобным софтом

Не стоит, но довольно часто такие советы по установке «левого» софта можно встретить. Ту же кафку часто так ставят.

Советы применить патч бармина тоже не редко встречаются, это не повод. Для помойки вполне достаточно /usr/local и /opt

Источник

Ошибки при компиляции «no input files»

Не могу разобраться как исправить ошибки. Подсобите кто как может. Скриншот прилагается.

Читайте также:  Login incorrect arch linux

Ошибка при компиляции «Incompatible implicit declaration of built-in function ‘exit’»
ОС Linux Home 2.6.25-std-def-alt8.M41.4 #1 SMP Sat Dec 6 14:42:12 MSK 2008 i686 GNU/Linux пробую.

Ошибки при компиляции
Народ помогите откомпилить. При запуске make — ругается, что нет такого файла. Почему? Все файлы в.

Ошибки при компиляции Hello world в eclipse.
Скачал Eclipse IDE for C/C++ с сайта, распаковал, запустил, создал новый проект, написал #include.

Напишите функцию expand(s1), заменяющую строку на сокращенную запись. Например, «Иванов» будет заменена на «И-в»
Нуждаюсь в вашей помощи

Файлы лежат в /home/lolka.

Добавлено через 1 минуту
«/home/lolka/bad.txt» — так правильно?

Гость — 2 Февраль, 2017 — 12:38
Тема старая, но для тех, кто попадет сюда с тем же вопросом – путь к каталогу с проектом не должен содержать кирилличных символов.

Гость — 7 Декабрь, 2017 — 16:42
Чтобы выполнялась компиляция на пути с кириллицей
в локализованной [ru] системе можно через меню CodeBlocks
Settings->Environment->View
установить параметр
[x] Internationalization (will take place after restart)
и перезапустить CodeBlocks.

Помощь в написании контрольных, курсовых и дипломных работ здесь.

Для заданного массива из 10 чисел проверить, есть ли в нем два числа, отличающихся ровно на 1, напечатать «да» или «нет»
Для заданного массива из 10 чисел проверить, есть ли в нем два числа, отличающихся ровно на 1, и.

При получения пакета возникает ошибка «Segmentation Fault»
Добрый день! Учился отправлять структуру по сети, натолкнулся на глюк. Если комментирую/удаляю.

Ошибка при использовании команды «make»
Вылезает ошибка при использовании команды «make» gcc -c -Wall -I include -F /Library/Frameworks.

Источник

No input file specified

I’m running Anchor CMS and I just upgraded to version 0.8. When I try and run the installer I get a ‘No input file specified’ error. I believe it’s more than likely a .htaccess problem but I’m not sure what the correct settings should be.

My site can be found here.

My .htaccess is set to:

I’m also using a GoDaddy as the hosting provider if that helps.

12 Answers 12

The No input file specified is a message you are presented with because of the implementation of PHP on your server, which in this case indicates a CGI implementation (can be verified with phpinfo() ).

Now, to properly explain this, you need to have some basic understanding on how your system works with URL’s. Based on your .htaccess file, it seems that your CMS expects the URL to passed along as a PATH_INFO variable. CGI and FastCGI implementations do not have PATH_INFO available, so when trying to pass the URI along, PHP fails with that message.

We need to find an alternative.

One option is to try and fix this. Looking into the documentation for core php.ini directives you can see that you can change the workings for your implementation. Although, GoDaddy probably won’t allow you to change PHP settings on a shared enviroment.

We need to find an alternative to modifying PHP settings
Looking into system/uri.php on line 40, you will see that the CMS attempts two types of URI detection — the first being PATH_INFO , which we just learned won’t work — the other being the REQUEST_URI .

This should basically, be enough — but the parsing of the URI passed, will cause you more trouble, as the URI, which you could pass to REQUEST_URI variable, forces parse_url() to only return the URL path — which basically puts you back to zero.

Now, there’s actually only one possibilty left — and that’s changing the core of the CMS. The URI detection part is insufficient.

Add QUERY_STRING to the array on line 40 as the first element in system/uri.php and change your .htaccess to look like this:

This will pass the URI you request to index.php as QUERY_STRING and have the URI detection to find it.

Читайте также:  User appdata local microsoft windows temporary internet files content ie5

This, on the other hand, makes it impossible to update the CMS without changing core files till this have been fixed. That sucks.

Need a better option?
Find a better CMS.

Источник

NGINX vs PHP-FPM: No input file specified

by Danila Vershinin , June 16, 2019 , revisited on February 14, 2020

NGINX PHP-FPM essentials

When you configure NGINX against PHP-FPM, what you really do is teach NGINX where is PHP-FPM listening and what kind of information has to be delivered to it.

NGINX does not do any processing of PHP scripts of its own. It merely talks to PHP-FPM and says:

and tell me what you see”.

In general, aside from some extra bits of information like environment variables, NGINX delivers one important piece of information to PHP-FPM – the filename of the script.

The standard bit of configuration illustrates it:

NGINX does not even need to have read access to the .php file in question in order to have it properly launched via PHP-FPM and then displayed to clients.

So this chmod in your site setup may be perfectly valid:

Note how NGINX has no access for index.php whatsoever, yet the page will work just fine in our setup.

Let’s expand to another case, our case of interest for this post.

What would happen when someone visits a non-existent .php file? NGINX will happily pass it along to PHP-FPM as usual, and PHP-FPM will return the dreaded:

This error is emitted by NGINX to the client’s browser. Because that’s what PHP-FPM happens to produce when you give it a filename that doesn’t exist.

Well, it’s a 404 error. Why bother? Sure enough, that’s not really the kind of error you want your users to see.

So in this post, I will tell you what are the dos and don’ts in fixing this error. That is, aside from obvious misconfiguration you might have.

Our case is when the script file is really not there. In other words, let’s see what is the best configuration approach to handling 404s for requests to missing .php files. And showing something better looking than No input file specified .

Solution on the PHP-FPM side? None that I know

There’s no way to customize the message. Well, in theory, you can patch and recompile PHP like those poor folks who like to play with NGINX compilation.

So let’s move on to NGINX. There are multiple ways to solve it there, and I tell you this – there are too many ways to do things inherently wrong. Use the power that NGINX gives you wisely.

Solutions in NGINX

Going down from worst to best.

Worst

You may have seen this one:

The idea is to check if .php script is really there, then rewrite to /index.php , which is supposed to know how to display 404 nicely (some CMS framework). Cute, nah?

You know why it’s already bad: if is evil. We all already know that blah blah.. Give me a break 🙂

But what would happen if we retain our very secure chmod ( 0400 on .php files) that we began our post with? We’ll get error upon accessing any .php file:

rewrite or internal redirection cycle while internally redirecting to “/index.php

Here’s why. When NGINX receives request for /some.php , it takes us to our location

All simply because it has no access for .php files.

Come on, just let NGINX read the .php files. It’s OK. Just let it be.

Well, I don’t want to if I can. There is never enough security. And secure chmod is something essential. Let’s keep trying.

So how about …

That’s cuter. No if s, just try_files . All as per NGINX ninja style. But wait, how about having the error page displayed by your PHP framework? Doable also with:

Читайте также:  Linux для слабых компьютеров tracker

Stop right there. We’re still letting NGINX check file for existence, so it’s still going to fail if it has no access to the scripts in our secure setup.

Best solution

I owe you some explanation, right? In our location

We tell NGINX what page to display upon receiving 404 from PHP-FPM, here: error_page 404 /404.php; .

We have to set up a dedicated location for /404.php because we know this script exists (you have to create it, of course, if your framework has none; and it must be different from the front page handler like index.php ). We don’t want to discard PHP-FPM output for it, so we put fastcgi_intercept_errors off; . Which is the default, so can be omitted but kept for illustration of what happens there.

Now NGINX doesn’t need to check for script existence. PHP-FPM will be the one to tell it.

So there you have it: a clean, tidy solution to 404 pages on missing .php script files in NGINX. It’s also secure and allows for lockdown chmod.

Источник

NGINX — No input file specified. — php Fast/CGI

Hi I need help in setting config for nginx. I am new to NGINX and facing some issues.

In my sites-available there is default file

It contain below code

Above code works perfectly when I write URL

www.test.com/service/public/testservice (testservice is folder within public) it says No input file specified.

How to fix it. thanks in advance.

I tried below, but no luck

18 Answers 18

You must add «include fastcgi.conf» in

Resolving «No input file specified» error

If you are using nginx with php-cgi and have followed the standard procedure to set it up, you might often get the “No input file specified” error. This error basically occurs when the php-cgi daemon cannot find a .php file to execute using the SCRIPT_FILENAME parameter that was supplied to it. I’ll discuss about the common causes of the error and it’s solutions. Wrong path is sent to the php-cgi daemon

More often than not, a wrong path (SCRIPT_FILENAME) is sent to the fastCGI daemon. In many of the cases, this is due to a misconfiguration. Some of the setups I have seen are configured like this :

Now, there are many things wrong with this configuration. An obvious and glaring issue is the root directive in the location / block. When the root is defined inside the location block, it is available/defined for that block only. Here, the location /images block will not match for any request because it does not have any $document _root defined and we will have to redundantly define root again for it. Obviously, the root directive should be moved out of the location / block and defined in the server block. This way, the location blocks will inherit the value defined in the parental server block. Of course, if you want to define a different $document_root for a location, you can put a root directive in a location block.

Another issue is that the value of the fastCGI parameter SCRIPT_FILENAME is hard-coded. If we change the value of the root directive and move our files somewhere else in the directory chain, php-cgi will return a “No input file specified” error because will not be able to find the file in the hard-coded location which didn’t change when the $document_root was changed. So, we should set SCRIPT_FILENAME as below :

We should keep in mind that the root directive should be in the server block or else, only the $fastcgi_script_name will get passed as the SCRIPT_FILENAME and we will get the “No input file specified” error.

Источник

Оцените статью