Search code examples
phpwindowsapachefastcginssm

"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.

Thank you.


Solution

  • This answer is about what I discovered above the issue, and how it is working for me.

    On this post and elsewhere on the net I found the advice to leave the doc_root in php.ini commented out:

    ;doc_root = 
    

    That works, in fact that's the configuration I use for all the abovementioned PHP 7.x installations, and for PHP 5.2 too. However, thats does not work for PHP 5.3 to 5.6.

    Reality is, for those versions of PHP, Apache's DocumentRoot and PHP's doc_root directives must match exactly.

    It was not easy to get here, due to the amount of deceiving or plain wrong information I found on the web (mostly due to PHP changing behavior from version to version):

    I hope this information is useful.

    NOTE:

    It took me a lot of time to solve this issue. One technique that I found useful is to increase Apache log level to trace8, as suggested here:

        LogLevel trace8