title: Running PHP from Perl Script
body: <p>I am attempting to run php scripts from a perl script on my goDaddy shared hosting.  The PHP script I originally wrote exceeds their 120 sec time limit and the mySQL memory limit, so I am breaking the script up into several parts.  </p>
  
  <p>I want this to all run as one cron job, so I want to call a single perl script that runs 4-5 php scripts. </p>
  
  <p>This is for my website, run with Drupal 7.</p>
  
  <p>I've written a perl script with the following content:</p>
  
  <pre><code>my $command = '/web/cgi-bin/php5 -q $HOME/html/phpscript1.php';
  exec ($command) or print STDERR "couldn't exec $command: $!";
  </code></pre>
  
  <p>Which calls a php scripts containing something like the following:</p>
  
  <pre><code>&lt;?php
  
  define('DRUPAL_ROOT', getcwd());
  
  include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  ....
  do stuff
  ....
  ?&gt;
  </code></pre>
  
  <p>But when I run this from perl (tried in both my $HOME directory and html directory) I see the following problems when I run the script (where XXXXXX is my godaddy account folder):</p>
  
  <pre><code>&lt;b&gt;Notice&lt;/b&gt;:  Undefined index:  SCRIPT_NAME   
  &lt;b&gt;/home/content/05/XXXXXXX/html/includes/bootstrap.inc&lt;/b&gt; on line &lt;b&gt;1627&lt;/b&gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined index:  REMOTE_ADDR in    
  &lt;b&gt;/home/content/05/XXXXXXX/html/includes/bootstrap.inc&lt;/b&gt; on line &lt;b&gt;2802&lt;/b&gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined index:  argc in
  &lt;b&gt;/home/content/05/XXXXXXX/html/includes/bootstrap.inc&lt;/b&gt; on line &lt;b&gt;3290&lt;/b&gt;&lt;br /&gt;
  </code></pre>
  
  <p>I've deduced that these are issues with FastGCI and that I probably need to define/export/point these index/variables to something, but I have been unable to find out what do to after extensive searching.</p>
  
  <p>The PHP script copies images from an external server to my server using CURL</p>