how to protect index.php file to override by any method on server


Actually, my server is hacked by someone and replace the index.php file, however, I have not used any form in the project but still this is hacked, I am in trouble please help me to protect my file as well as give me a solution to no one can replace the index.php file.