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)
- "No input file specified" for some versions of PHP
- No input file specified PHP error under IIS
- PHP pages on IIS say No input file specified
- IIS | PHP Error: No input file specified
- No input file specified PHP fastcgi
- https://serverfault.com/questions/990968/how-can-i-solve-no-input-file-specified-error-on-iis-for-urls-with-a-slash-and
- https://www.saotn.org/php-iis-no-input-file-specified/
- http://www.edugeek.net/forums/windows-server-2016/188383-iis-10-php-7-no-input-file-specified.html
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