Answers.Body: <p>What this is suggestive of is that the configuration setting for the mail account look in correct as its trying to retrieve emails to see if it needs to process them (for bounces or replies etc) and it can't find the relevant directories</p>
  
  <p>Seamus</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-02T18:14:51.323Z
Answers.Text: To state what's implicit in Seamus' reply - this is an issue with checking inbound mail.  Your outbound mail settings (e.g. SMTP vs `mail()`) shouldn't matter here.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-06T16:27:39.207Z
Answers.Text: Thanks Seamus and Jon for your help.  I've tried several combinations of settings in Administer>civimail>Mail Accounts with the result that either the cli.php cron would not work, or that if it did work, the php warnings persisted.  So I've now dispensed with the php.cli and am using a URL cron instead.  So far the CRON is working as it should and the warnings have stopped.
Answers.UserDisplayName: peterb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-02T03:36:59.120Z
Answers.LastActivityDate: 2017-01-02T03:36:59.120Z
Answers.UserDisplayName: Seamus Lee
Body: <p>Running Civicrm v4.7.14 on Wordpress v4.7 PHP v 5.6.29</p>
  
  <p>For the last couple of weeks, I've been getting the following PHP warning emails, mostly hourly, from my host's server, after the CRON runs with cli.php.
  All permissions are set correctly in root /httpdocs /wp-content /plugins /civicrm /civicrm /bin/cli.php.</p>
  
  <p>My host has investigated the email setup but found no problems.</p>
  
  <p>Everything else with CRON is working normally and all scheduled jobs are being executed as far as I can tell, with the exception of mail_report where error message is <em>"Finished execution of Mail Reports with result: Failure, Error message: A fatal error was triggered:  is not of type String"</em>.  I'm not sure whether this has any relevance and it would appear that this message was being received prior to when the PHP warnings started.</p>
  
  <p>Mail() is used (rather than SMTP).</p>
  
  <p>The PHP warning messages are as follows:
  PHP Warning:  scandir(INBOX/cur): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(INBOX/new): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(INBOX/cur): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(INBOX/new): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85</p>
  
  <p>Lines 85 to 89 in the Maildir.php file shows: 
  foreach (scandir($dir) as $file) {
          if ($file == '.' or $file == '..') {
            continue;
          }
          $path = $dir . DIRECTORY_SEPARATOR . $file;</p>
  
  <p>I'm not sure whether I have any missing core files and any help to find out the cause of these warning messages would be greatly appreciated.</p>
  
Tags: <wordpress><php><cron>
Title: PHP Warnings in maildir.php
ThreadText: # PHP Warnings in maildir.php
  
  (Asked by: username_0 on 2016-12-31)
  
  Running Civicrm v4.7.14 on Wordpress v4.7 PHP v 5.6.29
  
  For the last couple of weeks, I've been getting the following PHP warning emails, mostly hourly, from my host's server, after the CRON runs with cli.php.
  All permissions are set correctly in root /httpdocs /wp-content /plugins /civicrm /civicrm /bin/cli.php.
  
  My host has investigated the email setup but found no problems.
  
  Everything else with CRON is working normally and all scheduled jobs are being executed as far as I can tell, with the exception of mail\_report where error message is *"Finished execution of Mail Reports with result: Failure, Error message: A fatal error was triggered: is not of type String"*. I'm not sure whether this has any relevance and it would appear that this message was being received prior to when the PHP warnings started.
  
  Mail() is used (rather than SMTP).
  
  The PHP warning messages are as follows:
  PHP Warning: scandir(INBOX/cur): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(INBOX/new): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(INBOX/cur): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(INBOX/new): failed to open dir: No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: scandir(): (errno 2): No such file or directory in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/mysite.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php on line 85
  
  Lines 85 to 89 in the Maildir.php file shows:
  foreach (scandir($dir) as $file) {
  if ($file == '.' or $file == '..') {
  continue;
  }
  $path = $dir . DIRECTORY\_SEPARATOR . $file;
  
  I'm not sure whether I have any missing core files and any help to find out the cause of these warning messages would be greatly appreciated.
  
  **Tags:** wordpress, php, cron
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-02. Score: 1
  
  What this is suggestive of is that the configuration setting for the mail account look in correct as its trying to retrieve emails to see if it needs to process them (for bounces or replies etc) and it can't find the relevant directories
  
  username_1
  
  > **Comments:**
  > **username_2**: To state what's implicit in username_1' reply - this is an issue with checking inbound mail.  Your outbound mail settings (e.g. SMTP vs `mail()`) shouldn't matter here.  
  > **username_0**: Thanks username_1 and Jon for your help.  I've tried several combinations of settings in Administer>civimail>Mail Accounts with the result that either the cli.php cron would not work, or that if it did work, the php warnings persisted.  So I've now dispensed with the php.cli and am using a URL cron instead.  So far the CRON is working as it should and the warnings have stopped.  
  
  ---
  
  