0

I'm running a site on a dev. machine with the following features:

  • Operating System: Windows 11 (21H2, 22000.739)
  • Internet Information Server (IIS): 10.0.22000.739
  • PHP: 8.0.21 (and some others), Non-thread-safe, x64

Whenever I try to access a PHP file, for instance via http://localhost/test-php/index.php, I get a response:

No input file specified.

The website is running, because a flat HTML file (http://localhost/test-php/index.html) can be viewed without problem.

No errors are recorded in the PHP log file.

The machine in which this happens had been working with PHP with no problems previously. As we do not use it very often for PHP development, I cannot really tell what was installed or upgraded between the moment where it was working and now. Most probably: a number of Windows Updates + installation of Visual Studio 2022.

We have tried all kind of tests, as suggested by various posts on stack overflow and some other places. These include:

  • Making sure there are no file permissions problems (setting all permissions to "everyone" for all folders and files involved).

  • PHP.ini: set to value/set to blank/comment out: doc_root

  • PHP.ini: set to value/set to blank/comment out: open_basedir

  • PHP.ini: set cgi.force_redirect = 0 and cgi.force_redirect = 1

  • PHP.ini: leave completely empry

  • PHP.ini: minimalistic: include only recommendations from PHP Manager (cgi.force_redirect = 0, cgi.fix_pathinfo = 1, fastcgi.impersonate = 1, etc.)

  • PHP.ini: copy one from a machine where IIS+PHP is working as expected

  • Install several versions of PHP (7.4, 8.0.21, 8.1.latest), under different directories, with various php.ini settings.

  • Install PHP by using different methods: download .ZIP and install "by hand", use Microsoft Web Platform Installer, use PHP Tools for Visual Studio.

  • Set up PHP under IIS via PHP Manager (version 2.7)

  • Set up PHP under IIS manually (create handler mapping and FastCGI settings from IIS Manager)

  • Check Handler Mappings to make sure *.PHP mapping has checked the [x] Invoke handler only if request is mapped to: File or Folder

  • Completely uninstall and reinstall IIS from the machine.

Current settings in web.config are:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="php-8.0.21" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\PHP80\php-cgi.exe" resourceType="Either" requireAccess="Script" />
        </handlers>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="index.html" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>

Current PHP.ini (minimalistic):

[PHP]
extension_dir = "C:/PHP80/ext/"
log_errors = On
error_log = "C:/WINDOWS/Temp/php-8.0.21_errors.log"
upload_tmp_dir = "C:/WINDOWS/Temp/"
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1

[Session]
session.save_path = "C:/WINDOWS/Temp/"

[Date]
date.timezone = "Europe/Paris"

Current C:\Windows\System32\inetsrv\config related fastCgi settings:

<fastCgi>
    <application fullPath="C:\PHP80\php-cgi.exe" monitorChangesTo="C:\PHP80\php.ini" activityTimeout="300" requestTimeout="300" instanceMaxRequests="10000">
        <environmentVariables>
            <environmentVariable name="PHPRC" value="C:\PHP80\" />
            <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
        </environmentVariables>
    </application>
</fastCgi>

What we've already checked (with no success)

Frustratingly enough, all the changes we've made up until now have had no success at all; nor a hint in how to solve the problem. The fact that the machine used to work seems to indicate that the problem might be related to either:

  • Installing something "incompatible" that broke ALL existing PHP installations and all existing PHP websites.
  • Updating something (maybe some component of Microsoft IIS itself) that broke hell loose.

Any help will be greatly appreciated

joanolo
  • 6,028
  • 1
  • 29
  • 37
  • 1
    PHP 8 and above is no longer supported by Microsoft on IIS. You'd better enable WSL and run your PHP things on Linux. – Lex Li Jul 08 '22 at 15:33
  • https://stackoverflow.com/users/11182/lex-li - What surprises me is that I've been working until recently with no problems at all, and now neither PHP 8, nor 7.4 work. And Microsoft (AFAIK) never said it would stop supporting 7.4. – joanolo Jul 11 '22 at 10:45
  • PHP 7.4 is in Security Support only and will reach end of life in less than half a year. Thus, it is really not a good time to continue using it, https://www.php.net/supported-versions.php Microsoft does continue to support PHP 7.4, but probably not on a Windows 11 machine where nobody hosts their production sites. What I suggest is that you move everything to a clean Windows Server machine and see what happens there. – Lex Li Jul 11 '22 at 15:30

1 Answers1

0

Nothing works when trying to fix this issue. Move all your files to another directory and run the web application. Then copy it to the same location and run it again. It works for a certain time and breaks down. Actually, it looks like a bug.

  • Moreover. I get this error when there is another PHP application running on the same server with the same settings. No problem with it. Both are wordpress sites. I don't know if it's from the wordpress version. – splat1985 Nov 16 '22 at 10:51
  • I think here it solved my problem. [link](https://www.siteground.com/kb/no-input-file-specified-error). There was a .user.ini file in the home directory. It had **open_basedir** info in it. I changed the name of the file and the site worked. – splat1985 Nov 16 '22 at 10:59