Piwik site crashes intermittently under IIS

Hello,
I’ve deployed the latest (2.16.2) version under IIS, PHP 7, and every few hours the site goes down with the following error available in the log:
[14-Aug-2016 11:46:22 UTC] PHP Warning: require_once(C:\inetpub\wwwro): failed to open stream: No such file or directory in C:\inetpub\wwwroot\vendor\autoload.php on line 5 [14-Aug-2016 11:46:22 UTC] PHP Fatal error: require_once(): Failed opening required 'C:\inetpub\wwwroot\vendor/composer/autoload_real.php' (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\vendor\autoload.php on line 5

iisreset brings the site back up.

Note the weird ‘C:\inetpub\wwwro’ path, maybe it’s a clue?
I checked permissions, files existence, all seems to be in order. Any ideas?

Thanks a lot,
Greg

What is the content of the file C:\inetpub\wwwroot\vendor\autoload.php ? Maybe you could re-upload the files from a fresh download of: https://builds.piwik.org/piwik.zip

Apologies for the dealy in the answer, here’s the content of the autoload.php file:

<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderIniteba77972409e94ed670b69c630356f31::getLoader();

Which seems to be identical to the fresh download. I compared the files on the server to a fresh download and all the existing files are identical, there are several additional files on the server, which I believe is Ok since it’s a running site.

This is still happening, the updated errors from the log:

[05-Sep-2016 21:53:31 UTC] PHP Warning:  require_once(C:\inetpub\wwwroot): failed to open stream: Permission denied in C:\inetpub\wwwroot\core\bootstrap.php on line 41
[05-Sep-2016 21:53:31 UTC] PHP Fatal error:  require_once(): Failed opening required 'C:\inetpub\wwwroot/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\core\bootstrap.php on line 41
[05-Sep-2016 21:53:58 UTC] PHP Fatal error:  Uncaught Error: Class 'Piwik\ErrorHandler' not found in C:\inetpub\wwwroot\core\dispatch.php:16
Stack trace:
#0 C:\inetpub\wwwroot\index.php(27): require_once()
#1 {main}
  thrown in C:\inetpub\wwwroot\core\dispatch.php on line 16
[05-Sep-2016 21:54:13 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:54:37 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:55:11 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:55:43 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:56:16 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:56:47 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:57:23 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:57:53 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:58:26 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:58:58 UTC] PHP Fatal error:  Class 'Piwik\Exception\Exception' not found in C:\inetpub\wwwroot\core\Exception\NotYetInstalledException.php on line 11
[05-Sep-2016 21:58:58 UTC] PHP Fatal error:  Uncaught Error: Class 'Piwik\ErrorHandler' not found in C:\inetpub\wwwroot\core\dispatch.php:16

iisreset restores the site. Any thoughts?

Hi Greg,

Sorry I’m not sure what is the issue. To make sure we don’t forget this and maybe catch other users’ attention, would you mind create an issue in our tracker: Issues · piwik/piwik · GitHub

The first line of the log is “Permission Denied”. I would check that PHP has permission to read the file(s).

In all likelihood you need to set the permissions of all the files to the same group that the IIS user is in.

I will double check permissions, though I have already checked it. I doubt it’s the issue since the site functions just fine for several hours at a time…

I don’t run IIS - I use Apache on Linux.Why would PHP under IIS report a permissions issue if there isn’t one?

All of the following errors are produced because that one file is not readable. What is on line 41 of C:\inetpub\wwwroot\core\bootstrap.php?

require_once PIWIK_VENDOR_PATH . '/autoload.php';

Can you add a line before this one?

echo PIWIK_VENDOR_PATH;

and let us know what the printout is?

C:\inetpub\wwwroot/vendor

Also note that there are errors in the log such as:

[07-Sep-2016 09:51:13 Asia/Muscat] PHP Warning:  require_once(C:\inetpub\wwwro): failed to open stream: No such file or directory in C:\inetpub\wwwroot\core\bootstrap.php on line 31
[07-Sep-2016 09:51:13 Asia/Muscat] PHP Fatal error:  require_once(): Failed opening required 'C:\inetpub\wwwroot/core/testMinimumPhpVersion.php' (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\core\bootstrap.php on line 31

Note the partial c:\inetpub\wwro path, which doesn’t exit

There is something wrong with your install or did you purposely install Piwik at the root of your web server?

In my case I have Piwik in its own directory (Most people would) so that PIWIK_VENDOR_PATH would be C:\inetpub\wwwroot/Piwik/vendor

The sole purpose of the server was to host piwik, so I put it in the root folder on purpose.
I have moved it to internal piwik folder, agree it should be better practice. Will see if it changes anything.
Before that the crashes continued:

[09-Sep-2016 10:39:19 Asia/Muscat] PHP Warning:  require_once(C:\inetpub\wwwroot\core\testMinimumPhpVe): failed to open stream: No such file or directory in C:\inetpub\wwwroot\core\bootstrap.php on line 31
[09-Sep-2016 10:39:19 Asia/Muscat] PHP Fatal error:  require_once(): Failed opening required 'C:\inetpub\wwwroot/core/testMinimumPhpVersion.php' (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\core\bootstrap.php on line 31

there’s always a strange path written to log file, in this case C:\inetpub\wwwroot\core\testMinimumPhpVe

You may want to try adding the C:\inetpub\wwwroot path to your include_path in your php.ini file and see if that helps.

I am having the exact same problem, only mine is with a WordPress site running on Windows. This is the only other instance of this problem that I can find, and it’s exactly like what I’m seeing. Does anyone know if this was resolved and what the resolution was?

We still have this issue, we simply restart the site occasionally…