简体   繁体   English

处理php curl代码时出现内部服务器错误

[英]Internal Server Error while processing the php curl code

I have a 'curl' code in php as 我在PHP中有一个'curl'代码

  $ch = curl_init("http://www.abcd.in/upload.php");
   curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => "@$file", "file_name" => "$file_name"));

   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

   curl_exec($ch);


    curl_close($ch);

the upload.php is as upload.php是作为

 $file = $_FILES["file"]["tmp_name"];
 $file_name = $_POST["file_name"];
$file_extension = substr(strrchr($file_name, '.') , 1);

$path = "uploads/".date("YmdHis", time()).uniqid().".$file_extension";
move_uploaded_file($file, $path);

after executing this code although the image is getting uploaded,I am getting a Internal Server Error-500. 执行此代码后,尽管图像已上传,但出现内部服务器错误500。 How can I overcome this? 我该如何克服?

  1. This one can't work to upload anything, you forgot CURLOPT_POST . 这个人无法上传任何东西,您忘记了CURLOPT_POST
  2. IF you're getting 500, it can't be uploaded 如果您的收入达到500,则无法上传
  3. It's target server problem when it's returning 500. Check configuration 返回500时是目标服务器问题。检查配置

尝试查看apache日志错误并仅在安装时进行验证

sudo apt-get install curl php5-curl php5-xmlrpc 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM