DDoS (Distributed Denial of Service Attacks) are generally blocked on a server level right?
Is there a way to block it on a PHP level, or at least reduce it?
There are plugins you can use in apache for ddos/dos. Good start here http://www.debianadmin.com/how-to-protect-apache-against-dosddos-or-brute-force-attacks.html
If you're on LEMP, you can check here. http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html
These are good inexpensive starting points.