title: JQuery Ajax data sent time 500 Internal Server Error
body: <p>index.php</p>
  
  <pre><code>&lt;?php
  $path = "uploads/";
  $image = "";
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/imgareaselect-default.css" /&gt;
  &lt;script type="text/javascript" src="scripts/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="scripts/jquery.imgareaselect.pack.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function getCropImage(im,obj)
  {
      var x_axis = obj.x1;
      var x2_axis = obj.x2;
      var y_axis = obj.y1;
      var y2_axis = obj.y2;
      var thumb_width = obj.width;
      var thumb_height = obj.height;
  
      $.ajax({
          type:"GET",
          url:"flipimage.php?t=ajax&amp;img="+$("#image_name").val()+"&amp;w="+thumb_width+"&amp;h="+thumb_height+"&amp;x1="+x_axis+"&amp;y1="+y_axis,
          cache:false,
          success:function(response)
          { 
              //$("#cropimage").hide();
              $("#thumbs").html("");
              $("#thumbs").html("&lt;img src='uploads/"+response+"' width='700px' height='400px'/&gt;");
          }
      });
  }
  
  $(document).ready(function () {
      $('img#photo').imgAreaSelect({
          maxWidth: 1,
  //      maxHeight: 1,
          onSelectEnd: getCropImage
      });
  });
  &lt;/script&gt;
  &lt;?php
  
      $valid_formats = array("jpg", "jpeg", "png", "gif", "bmp","JPG", "PNG", "GIF", "BMP", "JPEG");
      $maxImgSize = 5*1024*1024;
      $randomName = md5(uniqid().date("Y-m-d H:i:s"));
      if(isset($_POST['submit']))
          {
              $name = $_FILES['photoimg']['name'];
              $size = $_FILES['photoimg']['size'];
  
              if(strlen($name))
              {
                  list($txt, $ext) = explode(".", $name);
                  if(in_array($ext,$valid_formats) &amp;&amp; $size &lt; $maxImgSize)
                  {
                      $randomImageName = $randomName.".".$ext;
                      $tmp = $_FILES['photoimg']['tmp_name'];
                      if(move_uploaded_file($tmp, $path.$randomImageName))
                      {
                          $image="&lt;div&gt;Please select the portion&lt;/div&gt;&lt;img src='uploads/".$randomImageName."' id=\"photo\" &gt;";
                      }
                      else {
                          if ($_FILES["photoimg"]["error"] &gt; 0)
                          {
                              echo "Error: " . $_FILES["photoimg"]["error"] . "&lt;br&gt;";
                          }
                      }
                  }
                  else
                  {
                      if($_FILES["photoimg"]["size"] &gt; $maxImgSize)
                          echo "Maximum file size exceeded";
                      else
                          echo "Invalid file";
                   }
              }
              else
                  echo "Please select a image";
          }
  ?&gt;
  &lt;body&gt;
      &lt;div&gt;
          &lt;div&gt;
              &lt;form id="cropimage" method="post" enctype="multipart/form-data"&gt;
                  Upload your image 
                  &lt;input type="file" name="photoimg" id="photoimg" /&gt;
                  &lt;input type="hidden" name="image_name" id="image_name" value="&lt;?php echo($randomImageName)?&gt;" /&gt;
                  &lt;input type="submit" name="submit" value="Submit" /&gt;
              &lt;/form&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;div&gt;
                  &lt;?php if($image != ''){ echo $image; }?&gt;
              &lt;/div&gt;
              &lt;div id="thumbs" style="margin-top:40px;"&gt;&lt;/div&gt;
          &lt;div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>flipimage.php</p>
  
  <pre><code>&lt;?php
  $path = "uploads/";
  
  function flip($image,$h=1,$v=0,$wid) 
  {
      $width = imagesx($image);
      $height = imagesy($image);
      $temp = imagecreatetruecolor($width,$height);
      imagecopy($temp,$image,0,0,0,0,$width,$height);
  
      $image1 = imagecreatetruecolor($width,$height);
      imagecopy($image1,$image,0,0,0,0,$width,$height);
  
      $leftwidth = 2*$wid;
      $totWid = (2*$width);
      $finalImage = imagecreatetruecolor($totWid,$height);
  
      if ($h==1) {
          for ($x=0 ; $x&lt;$width ; $x++) 
          {
              imagecopy($image1, $temp, $width-($x)-1, 0, $x, 0, 1, $height);
          }
      }
  
      for ($x=0 ; $x&lt;=$wid ; $x++) 
      {
          imagecopy($finalImage, $image, $x, 0, $x, 0, 1, $height);
          imagecopy($finalImage, $image1, $leftwidth-($x), 0, $width-($x), 0, 1, $height);
      }
  
      $rightWidth = $totWid-$leftwidth;
      for ($x=0; $x&lt;=$width-$wid; $x++) 
      {
          imagecopy($finalImage, $image, $totWid-$x, 0, $width-$x, 0, 1, $height);
          imagecopy($finalImage, $image1, $leftwidth+$x, 0, $x, 0, 1, $height);
      }
  
      return $finalImage;
  }
  if(isset($_GET['t']) and $_GET['t'] == "ajax")
  {
      extract($_GET);
  
      $extension = strtolower(strrchr($img, '.'));
      $file = $path.$img;
      switch ($extension) {
          case '.jpg':
              $image = imagecreatefromjpeg($file);
              break;
          case '.gif':
              $image = imagecreatefromgif($file);
              break;
          case '.png':
              $image = imagecreatefrompng($file);
              break;
          default:
              $image = false;
              break;
      }
  
      $new_name = "flip".$img;
      $image = flip($image,1,0,$x1);
      header("Content-type: image/jpeg");
      imagejpeg($image,$path.$new_name,90);
      echo $new_name.'?'.time();
      exit;
  }
  ?&gt;
  </code></pre>
  
  <p>I am trying to perform this AJAX post but for some reason I am getting a server 500 error. So the problem seems to be on the calltime. but it's working fine in localhost. but in live error occur.</p>