[英]PHP SMB File upload is successful but returns 500 Internal Server Error
[英]Upload error for PHP file - 500 internal server error?
我有用於從php上傳文件的上傳腳本,該腳本配置為從godaddy上傳托管服務器上的文件。 我在其他服務器域上使用的相同腳本無法在該服務器(也是Godaddy服務器)上上傳。 我具有對文件夾和服務器ftp的完全訪問權限,但仍然找不到為什么此腳本在該服務器上不起作用的原因。 任何人都可以找出為什么它會引發500錯誤。
<?php
$ftp_server = "ftp.xxxxx.com";
$ftp_username ="xxxx@xxxx.com";
$ftp_password = "xxxxxxxxxxx";
$destination_folder = "/upload/";
$file_name = $_FILES["userfile"]["name"];
$destination_file = $destination_folder.time().'_'.$file_name;
$file = $_FILES["userfile"]["tmp_name"];
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
// upload a file
if (ftp_put($conn_id, $destination_file, $file, FTP_BINARY)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
你有shell訪問權限嗎? 如果是這樣,請reconfig apache
。 聽起來與您的問題無關,但這可以解決。 我前段時間遇到了這個問題, rebuilding apache
解決了它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.