title: PHP Include Not Working in Cron Job
body: <p>I have a PHP script that works fine when run from the browser, but when run as a cron job (which was set up via cPanel), it doesn't. The server is running Linux.</p>
  
  <p>I've narrowed it down to an include statement:</p>
  
  <pre><code>$include_path = dirname(__FILE__) . "/";
  $wpconfig = $include_path . 'blog/wp-config.php';
  include($wpconfig);
  </code></pre>
  
  <p>I've also tried using realpath(dirname(<strong>FILE</strong>)) instead of just dirname(<strong>FILE</strong>), and just trying to include "blog/wp-config.php", but it makes no difference.</p>
  
  <p>The PHP script resides in this folder:</p>
  
  <p>/home2/USERNAME/public_html/DOMAIN/tools/</p>
  
  <p>The file I need to include is in this folder, which is one level below the one where the PHP script resides:</p>
  
  <p>/home2/USERNAME/public_html/DOMAIN/tools/blog/wp-config.php</p>
  
  <p>I thought using an absolute path should work in a cron job, but apparently not.</p>
  
  <p>I'm clearly doing something wrong (or stupid), so could someone please put me out of my misery and point me in the right direction.</p>
  
  <p>Thanks!</p>