Sure,
question is: how would you run it?
You need a virtual host that is on the same server and has access to the directory you need to back up.
The simplest would to simply use a system call to GNU tar, since that would spare you the time consuming directory traversal.
Then use either the supplied zlib functions or another system call to your favourite compression program.
On windows you might want to look into the command-line support extension for winzip, to accomplish this.