2

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:

    doc_root = "C:\inetpub\wwwroot"
    
    cgi.force_redirect = 0
    

    ...and ran iisreset (per https://support.qualityunit.com/428346-I-see-error-No-input-file-specified-on-IIS-server).

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

[PHP]

engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
open_basedir = "C:\inetpub\wwwroot"
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On

; Resource Limits ;
max_execution_time = 30
max_input_time = 60
memory_limit = 128M

; Error handling and logging ;
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = On
html_errors = On
error_log = "php_errors.log"

; Data Handling ;
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"

; Paths and Directories ;
doc_root =      ; Have also tried doc_root = "C:\inetpub\wwwroot" -- no change
user_dir =
extension_dir = "ext"
enable_dl = Off
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
fastcgi.logging = 0

; File Uploads ;
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20

; Fopen wrappers ;
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60

; Dynamic Extensions ;
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
extension=php_openssl.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_shmop.dll

; Module Settings ;

[CLI Server]
cli_server.color = On

[Date]
date.timezone = "America/Chicago"

[filter]

[iconv]

[intl]

[sqlite3]

[Pcre]

[Pdo]

[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=

[Phar]

[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1

[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"

[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

[MySQLi]

mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = On

[OCI8]

[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10

[bcmath]
bcmath.scale = 0

[browscap]

[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatibility_mode = Off
mssql.secure_connection = Off

[Assertion]

[COM]

[mbstring]

[gd]

[exif]

[Tidy]
tidy.clean_output = Off

[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5

[sysvshm]

[ldap]
ldap.max_links = -1

[mcrypt]

[dba]

[opcache]

[curl]

[openssl]

I have a test PHP file as follows:

<html>
<head>
    <title>PHP Test</title>
</head>
<body>
    <?php echo '<p>Hello World</p>'; ?> 
</body>
</html>

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.

Update

Commenting out doc_root in the php.ini file turned out to be a step in the right direction. It now works in virtual directories that are located in my Documents folder. But I'm still getting the error in my development websites, which are located in my OneDrive folder. I suppose I could make copies in my Documents and use those for development, but I'd really like to avoid that, if there's something I'm missing.

Katerine459
  • 465
  • 1
  • 3
  • 13
  • Changes to `php.ini` are no longer part of Microsoft documentation, https://learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php#13-download-and-install-php-manually Revert them and try again. You can also run PHP Diagnostics to see if it detects anything https://www.jexusmanager.com/en/latest/tutorials/php-diagnostics.html – Lex Li Apr 10 '18 at 21:22
  • Thanks, Lex. I tried the PHP diagnostics, and got no errors. Info: Found PHP config file C:\Program Files (x86)\PHP\v5.6\php.ini. PHP loadable extension folder: C:\Program Files (x86)\PHP\v5.6\ext No extension to verify. PHP installation has been added to Windows Path environment. --- Not sure what I should revert or how? Please treat me as a complete newb. :) – Katerine459 Apr 10 '18 at 21:43
  • try to delete `php.ini` and test `phpinfo.php` as the Microsoft article suggested. – Lex Li Apr 10 '18 at 22:25
  • I don't see that suggestion... but I went ahead and renamed php.ini and reset IIS. phpinfo.php does still work, although most of the values are now broken. Still getting the "No input file specified." error on all other pages, so it doesn't appear that it helped. – Katerine459 Apr 11 '18 at 01:17
  • The broken values in `phpinfo.php` might simply indicate what's up, but you kept them as secrets and no one would be able to help. – Lex Li Apr 11 '18 at 03:41
  • Pretty much everything broke when I removed php.ini. Can you point me to some value that I can look for, for what might be causing the "No input file specified" problem? – Katerine459 Apr 11 '18 at 03:53
  • Ok... this is frustrating. This is a serious problem I'm having, and if I understand your issue with my question, it's that I'm not posting the results of phpinfo.php. But the output of phpinfo.php is 26 screens long (not counting the credits), and it's in table format, which means I couldn't copy/paste the output to stackoverflow, even if it were advisable. What is it that I should be doing? – Katerine459 Apr 11 '18 at 04:08
  • I do appreciate the help you've tried to give so far, btw. But I'd really like it to not stop just because I legitimately don't know how to distinguish between helpful and non-helpful information for this problem. I really tried to go into all the details I could in the question. – Katerine459 Apr 11 '18 at 04:11
  • Update on the problem (hoping you're still willing to help): I just discovered something else. When I put a "hello world" php file in the C:\inetpub\wwwroot directory, it works. But the same file 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 in phpinfo.php that, if I shared it with you, might shed light on why this is happening? – Katerine459 Apr 11 '18 at 04:16
  • 1
    I have no problem running `php-info.php` or other test pages even if they are outside of `C:\inetpub\wwwroot`. Find a clean machine and restart your PHP setup there by strictly following https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php#13-download-and-install-php-manually . Microsoft says "C:\inetpub\wwwroot\" simply because it assumes 1) PHP is configured at server level, 2) you work on the Default Web Site. But if you create your own site, pointing to another location on disk, it should still work. – Lex Li Apr 12 '18 at 20:03
  • Thanks for your effort, Lex. I found the solution (below). – Katerine459 Apr 13 '18 at 19:29

4 Answers4

2

After much beating my head against the wall, I finally found that it was all due to a bug with PHP and OneDrive. https://bugs.php.net/bug.php?id=75384

Upgraded PHP to the latest version, and also turned off the OneDrive setting, "Save space and download files as you use them." Rebooted, and it finally worked.

Katerine459
  • 465
  • 1
  • 3
  • 13
  • Hmm same problem - first included file works, but no further files. That oneDrive setting is under administrative control on our network... – A2D Mar 27 '19 at 16:39
2

My solution was to comment both

;open_basedir

and

;doc_root

Kachinga
  • 194
  • 1
  • 7
0

This error means, that your PHP is not configured correctly in your IIS server. Resolution of problem: Open php.ini file and review the doc_root setting. Example of value could be following setting:

doc_root = "d:\Inetpub\wwwroot"

The comments above this setting say:

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you    
SHOULD set doc_root
; if you are running php as a CGI under any web server
(other than IIS)
; see documentation for security issues. The alternate is     
to use the
; cgi.force_redirect configuration below

If you are using PHP in ISAPI mode, not CGI, try comment out the setting so it will look like this:

; doc_root = "d:\Inetpub\wwwroot"

Then save php.ini and restart IIS by opening a command prompt (Start => Programs => Accessories => Command Prompt) and type the command:

iisreset

This should fix the problem!

Hopper
  • 11
  • 4
  • Thank you, Sajal, but I actually already tried that before posting the question. :) It didn't help. Since PHP works for items that are in my inetpub\wwwroot directory, but not for items that are in any of my development websites (which are scattered in directories in my Documents, because that's what makes the most sense), I suspect that this may be contributing to the problem, actually. Is there anything that will make things work in virtual directories? (Actually, I know there is, because this used to work, but I can't figure out how). :) – Katerine459 Apr 11 '18 at 17:11
0

I found the solution here:
https://www.experts-exchange.com/questions/20983403/PHP-Windows-no-input-file-specified-error-virtual-directory.html

Turned out all I had to do was... the polar opposite of what all the other online instructions said to do. I had to comment out the doc_root line in the php.ini file. Once I did that, the problem was fixed.

EDIT

Spoke too soon. Turns out this makes it work on my test websites, but not on my actual development websites, which are on OneDrive. Will update my question with the new info. Still, this is a step in the right direction, and at least it opens up a possible workaround.

Katerine459
  • 465
  • 1
  • 3
  • 13