500 Error, please check your php script / enable display_errors in your cpanel
Other Information
Hello, I attempted to add a file to the site, another PHP that would let me upload files since filemanager.ai wasnt working to upload and would keep saying I hit my quota for the FTP but I haven’t hit that yet and was wondering what to do, I keep getting the internal 500 server error and I attempted to enable errors from the dashboard but it did not work.
Can you please tell us more about this specific PHP script you tried to upload? In the meantime, you can use FTP to manage files on your website. It’s much more stable than trying to use the online file manager.
So basically this is exactly the code I put into the site:
<?php
// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
$targetDir = __DIR__; // Get the current directory
$targetFile = $targetDir . DIRECTORY_SEPARATOR . basename($_FILES['file']['name']);
// Check if the file is uploaded successfully
if (move_uploaded_file($_FILES['file']['tmp_name'], $targetFile)) {
echo "File has been uploaded successfully.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload</title>
</head>
<body>
<h2>Upload a File</h2>
<form action="" method="post" enctype="multipart/form-data">
<label for="file">Choose a file to upload:</label>
<input type="file" name="file" id="file" required>
<input type="submit" value="Upload File">
</form>
</body>
</html>
And with that I can’t even access the site it just shows this error for the entire site:
The OP already did that with no success; plus the error is generated by the server, so enabling Display Errors doesn’t help.
@flzyy_r, you might need to check the rules on your .htaccess file and remove the ones you find problematic, as the error is generated by the server and not the browser.