title: 500 Internal Server Error PHP Script - Tried most answers
body: <p>My script seems to be returning a 500 error whenever pictures are attached, however it is returning the files I wanted in my directory?  I've tried phpinfo() and put a bespoke .user.ini in my directory and I'm still ending up with the error.  I'm using Godaddy &amp; Plesk if that helps?</p>
  
  <pre><code>&lt;?php
  
  set_time_limit(0);
  ignore_user_abort(1);
  ini_set('memory_limit','512M');
  
  require('fpdf/fpdf.php');
  $pdf = new FPDF();
  $pdf-&gt;AddPage();
  $pdf-&gt;SetFont('Helvetica','B',10);
  $pdf-&gt;Image('some-url',10,10,50,50,'gif');
  $pdf-&gt;SetXY(70,28);
  $pdf-&gt;Cell(0,0,"Title",0,0,'C');
  $pdf-&gt;SetXY(70,40);
  $pdf-&gt;Cell(0,0,"Job Completion Certificate",0,0,'C');
  $pdf-&gt;SetY(60);
  $pdf-&gt;Write(14,$Data);
  $pdf-&gt;SetY(225);
  if(! empty($_POST["signature"])){
  $pdf-&gt;Image($_POST["signature"],null,null,0,0,'png');
  };
  $pdf-&gt;AddPage('P','A4');
  
  $allowedExts = array("gif", "jpeg", "jpg", "JPG", "JPEG", "PNG","png");
  $pictures = array("file1", "file2", "file3");
  $counter = 10;
  
  foreach ($pictures as $value)
  {
  if ( ! empty($_FILES[$value]["tmp_name"])
  &amp;&amp;($_FILES[$value]["size"] &lt; 4000000)
  &amp;&amp; in_array(end(explode(".", $_FILES[$value]["name"])), $allowedExts))
  {
    move_uploaded_file($_FILES[$value]["tmp_name"],$_FILES[$value]["name"]);
    $pdf-&gt;Image($_FILES[$value]["name"],25,$counter,80,80);
    //unlink($_FILES["file"]["name"]);
    $counter += 90;
  }
  else
    {
    echo $value." is either Invalid or Not Attached&lt;br&gt;";
    };    
  };
  $pdf-&gt;Output($_POST["Customer"]."_".$_POST["Location"].'.pdf', 'F');
  
  print "Data Written"; 
  
  ?&gt;  
  </code></pre>
  
  <p>If I comment out this section of the code:</p>
  
  <pre><code>foreach ($pictures as $value)
  {
  if ( ! empty($_FILES[$value]["tmp_name"])
  &amp;&amp;($_FILES[$value]["size"] &lt; 4000000)
  &amp;&amp; in_array(end(explode(".", $_FILES[$value]["name"])), $allowedExts))
  {
    move_uploaded_file($_FILES[$value]["tmp_name"],$_FILES[$value]["name"]);
    $pdf-&gt;Image($_FILES[$value]["name"],25,$counter,80,80);
    //unlink($_FILES["file"]["name"]);
    $counter += 90;
  }
  else
    {
    echo $value." is either Invalid or Not Attached&lt;br&gt;";
    };    
  };
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>Edit:</p>
  
  <p>After further inspection and changing my web.config file (see <a href="http://support.godaddy.com/help/article/3430/disabling-windows-custom-error-messaging?locale=en&amp;ci=46061" rel="nofollow">http://support.godaddy.com/help/article/3430/disabling-windows-custom-error-messaging?locale=en&amp;ci=46061</a>) I get this error:</p>
  
  <pre><code>PHP Strict Standards:  Only variables should be passed by reference in G:\PleskVhosts\mysite\httpdocs\action.php on line 48
  </code></pre>