500内部服务器错误PHP脚本 - 尝试最答案(500 Internal Server Error

2019-10-19 06:19发布

我的剧本似乎无论何时返回图片连接一个500错误,但是它返回我在目录想要的文件? 我试过phpinfo()函数,并把一个定制.user.ini在我的目录,我仍然与错误结束了。 我使用的是Godaddy的和Plesk中是否有帮助?

<?php

set_time_limit(0);
ignore_user_abort(1);
ini_set('memory_limit','512M');

require('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Helvetica','B',10);
$pdf->Image('some-url',10,10,50,50,'gif');
$pdf->SetXY(70,28);
$pdf->Cell(0,0,"Title",0,0,'C');
$pdf->SetXY(70,40);
$pdf->Cell(0,0,"Job Completion Certificate",0,0,'C');
$pdf->SetY(60);
$pdf->Write(14,$Data);
$pdf->SetY(225);
if(! empty($_POST["signature"])){
$pdf->Image($_POST["signature"],null,null,0,0,'png');
};
$pdf->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"])
&&($_FILES[$value]["size"] < 4000000)
&& in_array(end(explode(".", $_FILES[$value]["name"])), $allowedExts))
{
  move_uploaded_file($_FILES[$value]["tmp_name"],$_FILES[$value]["name"]);
  $pdf->Image($_FILES[$value]["name"],25,$counter,80,80);
  //unlink($_FILES["file"]["name"]);
  $counter += 90;
}
else
  {
  echo $value." is either Invalid or Not Attached<br>";
  };    
};
$pdf->Output($_POST["Customer"]."_".$_POST["Location"].'.pdf', 'F');

print "Data Written"; 

?>  

如果我注释掉的代码的这一部分:

foreach ($pictures as $value)
{
if ( ! empty($_FILES[$value]["tmp_name"])
&&($_FILES[$value]["size"] < 4000000)
&& in_array(end(explode(".", $_FILES[$value]["name"])), $allowedExts))
{
  move_uploaded_file($_FILES[$value]["tmp_name"],$_FILES[$value]["name"]);
  $pdf->Image($_FILES[$value]["name"],25,$counter,80,80);
  //unlink($_FILES["file"]["name"]);
  $counter += 90;
}
else
  {
  echo $value." is either Invalid or Not Attached<br>";
  };    
};

它工作正常。

编辑:

经进一步检查,并改变了我的web.config文件(见http://support.godaddy.com/help/article/3430/disabling-windows-custom-error-messaging?locale=en&ci=46061 )我得到这个错误:

PHP Strict Standards:  Only variables should be passed by reference in G:\PleskVhosts\mysite\httpdocs\action.php on line 48

Answer 1:

我最后不得不到我的代码更改为以下:

...
foreach ($pictures as $value)
{
$temp = explode(".", $_FILES[$value]["name"]);
$extension = end($temp);    
if ( ! empty($_FILES[$value]["tmp_name"])
&&($_FILES[$value]["size"] < 4000000)
&& in_array($extension, $allowedExts))
{...

如果任何人的斗争越来越显示在godaddy的&的Plesk了错误按照上面的链接,并把web.config文件在根文件夹,你的页面是在文件夹中。一旦你能看到的问题是,它更容易一大堆解决!



文章来源: 500 Internal Server Error PHP Script - Tried most answers
标签: php fpdf