No input file specified php windows

“No input file specified” for some versions of PHP

I have multiple versions of PHP installed as per this guide, that I wrote. Basically, it is an ApacheLounge installation talking to PHP via FastCGI on Windows 10. This used to let me run these PHP versions at the same time on different VirtualHosts. Apache calls the proper PHP version via FastCGI on these ports:

  • PHP 5.2.17 on port 9052
  • PHP 5.3.29 on port 9053
  • PHP 5.4.45 on port 9054
  • PHP 5.5.38 on port 9055
  • PHP 5.6.40 on port 9056
  • PHP 7.0.33 on port 9070
  • PHP 7.1.33 on port 9071
  • PHP 7.2.31 on port 9072
  • PHP 7.3.19 on port 9073
  • PHP 7.4.7 on port 9074

Everything Some of these had been working for a while after the installation. Yesterday I had to test a website on PHP 5.6, but the ouput was just a «No input file specified message» which, turns out, is not that much descriptive, as a quick google search confirmed.

So I started a systematic approach. I created a VirtualHost for every PHP version, with just a index.php file with an echo statement. I tested all PHP versions installed, and all PHP5 versions did not work, while PHP7 versions worked as usual.

I removed all custom configuration files. No change.

I served a simple index.html file, and that works on all VirtualHosts. About PHP, no change.

I thought it was PHP 5.x bug, but after I rebooted my PC, the PHP 5.2 version started working. I stopped, removed and reinstalled some of the Windows Services create via NSSM, with no change.

This is what I think I know:

  • it is not a PHP 5.x issue, because PHP 5.2 works;
  • it is not a FastCGI problem, because all VirtualHosts have the same configuration, except for the port number;
  • it is not an Apache configuration problem, because it starts and stops and reboots and serves;
  • it is not a PHP configuration problem, beacuse all configuration is standard;
  • it is not a .htaccess configuration problem, because there are no .htaccess files;

Any idea about how to debug this configuration, or about what is going wrong is appreciated.

.htaccess issues: No input file specified

Can someone help me with this? I’m feeling like I’ve been hitting my head against a wall for over 2 hrs now.

I’ve got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htaccess with the code below works fine, no errors.

The same code on my hosting provider server gives me a 404 error code and outputs only: No input file specified. index.php is there. I know they have Apache installed (cannot find version info anywhere) and they’re running PHP v5.2.8.

Читайте также:  Windows multimedia platform для чего

I’m on Windows XP 64-bit , they’re running some Linux with PHP in CGI/FastCGI mode. Can anyone suggest what could be the problem?

PS. if that’s important that’s for CodeIgniter to work with friendly URLs.

mod_rewrite is installed and on.

What I’ve noticed is that if I change in RewriteRule to /index.php?$1 (question mark instead of forward slash) it goes into an infinite loop. Anyway, using question mark isn’t an option as CodeIgniter (required) is not going to work this way.

Homepage also works when I request index.php directly: example.com/index.php

I’m starting to think it might be apache thinking that once the trailing slash is added it is not a file anymore but a folder. how to change such a behaviour?

I was wrong.
Apache handles these URLs correctly.
Requesting http://example.com/index.php/start/ (homepage) or any other valid address works.
Seems that Apache is just not forwarding the query for some reason.

Just to be clear what I’m trying to achieve.
I want to rewrite addresses like that:

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.

Читайте также:  Ati x1300 driver windows 10

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.

Когда выдаётся сообщение «No input file specified» ?

Новичок

Когда выдаётся сообщение «No input file specified» ?

В строке браузера делаю запрос типа страницы one.html.
В htaccessе этот запрос перенаправляется(FilesMatch) на index.shtml в котором шаблон базовой страницы и include на скрипт php (script.cgi) который находится в папке cgi, где и лежат все скрипты.

в script.cgi написано:

Но. Вместо результата работы скрипта выдаётся сабжевое сообщение.

Как это можно исправить? В чём может быть дело?

Если на прямую сослатmся на index.shtml, то всё работает.
PHP Version 5.0.2 установлен как cgi.
Apache — 1. чего то там.
unix os — red hat похоже.

kvf77

Red Devil

ну так покажи каким образом запрашиваешь — кусок кода короче

Новичок

В строке браузера:

Action throw /dir1/index.shtml

ForceType throw

kvf77

Red Devil

ну я так и думал — FAQ читать кто-нибудь начнет?

Различия между абсолютными и относительными путями:
http://phpfaq.ru/paths

Новичок

Почитал фак. Это никак не помогло. Ничего нового.
Лучше скажите где конкретно я совершил ошибку если так?

Напомню, что при прямом обращении к фалу index.shtml — всё работает.

alexhemp

Новичок

Ты совершил ошибку не указав правильный путь к файлу — это очевидно. Как указать путь правильно написано по ссылке данной тебе выше.

Новичок

А в каком месте я непрально указал путь к файлу?
Скажите конкретно. Я не просто так настаиваю. Подозреваю что проблема глубже чем просто неверный линк. Потому что я пробовал все возможные варианты линков(относительные/абсолютные). И тот что приведён в примере один единственный который работает.

alexhemp
Дык какому файлу я неправильно указал путь? (я не могу понять)

А подсказать видимо никто не подскажет.

Я пробовал ссылатся на скрипт на прямую через htaccess:
AddHandler mytype .html
Action mytype /cgi/script.cgi

И всё равно та же надпись падает:
No input file specified.

Похоже, что по каким то причинам интерпретатор пхп некооретно запускается, или вообще не воспринимает файл со сриптом если к нему обращаются через htaccess. Вопрос почему.

Фанат

oncle terrible

сообщение No input file specified выдаётся тогда, когда интерпретатор запускается, но никакого имени файла ему не передаётся.

Надо сказать, что твоя ситуация довольно странная.
Во-первых — чудовищное нагромождение вызовов(этот перенаправил туда, тот инклюдит второго, второй вызвал третьего, третий проинклюдил ещё что-то).
Неужели нельзя отлаживать скрипт напрямую? и далее по цепочке ловить косяк?
во-вторых, довольно странное сообщение, действительно. я такое получал в командной строке только если неверно указывал файл со скриптом.

Читайте также:  Что делать если копия windows не прошел проверку

а /cgi/ это виртуальная, как я понимаю, директория?

PHP error: “No input file specified.” in IIS 10.0, PHP 5.6 on local development server

I’ve got an issue with my development server. Running Win 10 Pro, IIS 10.0.16299, PHP 5.6 (installed to C:\Program Files (x86)\PHP\v5.6 ). This is a recent issue; PHP used to work just fine, but then it just stopped working.

All my PHP apps are now returning the error, «No input file specified». These apps are within «Default Web Site,» but are located elsewhere (with my work stuff). They are configured in IIS, and sharing should be set up properly (since everything used to work).

Here’s what I’ve tried, per all of the information I’ve found online. Nothing’s worked, however:

    Uninstalled and reinstalled IIS from Control Panel | Programs and Features | Turn Windows Features on and off. After reinstalling, added FastCGI handler to IIS, pointing to C:\Program Files (x86)\PHP\v5.6\php-cgi.exe . Also double-checked that the PATH includes the PHP directory.

Replaced php.ini (in the 5.6 directory) with the development copy, and updated these lines to the following:

Scanned my disk for errors, ran a full virus scan, checked my hosts file to make sure nothing’s amiss.

I’ve also read over the info in this question, but I’m afraid a lot of it went over my head. I’m a programmer who occasionally works in PHP, I’m afraid, not a system administrator.

One other note: While my php apps all return this error, the C:\inetpub\wwwroot\phpinfo.php file does not (this file has one line of code: phpinfo(); ). That file works.

Update

When I put a «hello world» php file in the C:\inetpub\wwwroot directory, it works. But the same file causes the problem error in my website: C:\Users\Katie\Documents\Work\Website Working Copy\ . This directory is mapped to a web application within «Default Web Site» in IIS. IUSR and IIS_IUSRS have permissions to this folder. Is there anything from phpinfo() that, if I shared it, might shed light on why this is happening?

Update

I’ve completely replaced the PHP installation with the newest non-thread-safe version of PHP 5.6.

This is the php.ini file now in C:\Program Files (x86)\PHP\v5.6 (minus all of the commented stuff):

I have a test PHP file as follows:

So, to reiterate, the issue is that, when this file is in C:\inetpub\wwwroot\, and access through http://mymachinename/temphello.php, it works correctly. But when it’s in one of the virtual directories (actually, applications) I’ve set up through IIS underneath «Default Web Site,» and access through http://mymachinename/applicationname/temphello.php, it returns, «No input file specified.»

I need PHP to work, regardless of where the virtual directory is located. I know this is possible, because it worked for years, until last week when it mysteriously stopped working as soon as I cleared my application cache.

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