Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 554
Spyryto Avatar asked Feb 10 '21 15:02

Spyryto


People also ask

Why does it say No input file specified?

Why do we see No input file specified error in WordPress? Mostly, the No input file specified error shows up while loading the website after a migration. This problem can be easily resolved by tweaking the PHP version, correcting . htaccess file, disabling faulty plugins and so on.


1 Answers

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):

  • this (unsolved) bug report with a similar issue has a user comment that advises to leave doc_root commented out;

  • this paragraph is contradictory;

  • PHP's documentation is wrong for those particular versions, correct for the current ones:

    on Description of core php.ini directives:

     Name        Default    Changeable
     doc_root    NULL       PHP_INI_SYSTEM
    

    and on Where a configuration setting may be set:

     PHP_INI_SYSTEM  Entry can be set in php.ini or httpd.conf
    

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
like image 116
Spyryto Avatar answered Sep 22 '22 14:09

Spyryto