Use PHP functions instead of system calls