Replaced some system commands with PHP alternatives