I have a problem loading a file via php when the cpanel user has shell access set to "Jailed Shell", the php call goes into error 400 without php errors, but with an apache error:
ModSecurity: Failed to open temporary file for reading: /var/imunify360/tmp_modsec/20240724-102950-ZqC7ful4atLhSh-vQAf-1AAAAAY-request_body-S2rU78.
Obviously when I set the shell access from "Jailed" to "Normal" the problem disappears and the file is loaded correctly, but I need the user to have the Jailed shell
My php code:
function uploadPdf($file)
{
$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/public/uploads/';
$file_path = $upload_dir . basename($file['name']);
if (move_uploaded_file($file['tmp_name'], $file_path)) {
} else {
}
}
I have already tried to change the permissions on the /var/imunify360/tmp_modsec folder to 777 but the error remains.
I solved it with this procedure: