There are many ways of debugging php. I will start creating a reference guide here.
One of the best references out there: https://phptherightway.com/
Activate showing php errors either in the application itself, cpanel or php.ini.
error_reporting(E_ERROR | E_WARNING);
Dumping variables
var_dump($variable_name);
file_put_contents("dump.txt", ob_get_contents());
ob_end_clean();
key words: debug