title: Cron script Prestashop (php)
body: <p>I need to make a <strong>cron script</strong> ('cron_script.php') that updates a XML. The static functions that make this are defined in my main module class 'xmlmodule.php'. </p>
  
  <p>My problem is the <strong>cron script doesn't run module class with 'require' or  'require_once'</strong>. The prestashop configuration values are not loaded in script so is always exiting. If I comment the 'if' statement for check '_PS_VERSION_' I have an error output because is not finding the 'Module' class.</p>
  
  <p>Here is my module main class ('xmlmodule.php'):</p>
  
  <pre><code>&lt;?php
  
  if (!defined('_PS_VERSION_')) {
      exit;
  }
  
  class XmlModule extends Module {
      //Module functions
  }
  </code></pre>
  
  <p>And this is my cron script:</p>
  
  <pre><code>&lt;?php
  ini_set('display_errors', 1);
  ini_set('display_startup_errors', 1);
  error_reporting(E_ALL);
  
  echo "Before require once &lt;/br&gt;";
  require_once('xmlmodule.php'); //This exits the script
  echo "&lt;h2&gt;Prueba CRON updateFeed&lt;/h2&gt;"; //Never executed
  </code></pre>
  
  <p>I'm executing it locally with <strong>curl and crontab</strong> and my PrestaShop version is 1.6 with <strong>PHP7.0</strong>. I know about modules use cron scripts but I can find anything of code for see how to do it.</p>
  
  <p>Does anyone know? Thanks a lot.</p>