You want one application to reboot the machine. That's pretty easy, see above, as long as the application is running as root or at least in the operator group. If your application is not running as root, one option is to use sudo: let your script execute sudo with suitable arguments, and configure sudo.
The harder part is your second request: you want to start a PHP script upon booting. That's not easy, because after booting, all "state" or "memory" of what was running before boot has been forgotten. I would propose the following: make your application into a service (see man rc, or read the handbook), and start the service upon booting. That requires you to learn how to write rc.d scripts, but that's not very difficult, and a good skill to have.
Where it gets really gnarly: You might want to not *always* start that application on every boot, only if your application requested that it be started on the next reboot. There are many ways to accomplish it. Here's what I would do: Before rebooting, have your application leave some information in a well-known place, like a status file in the file system. When the new service starts, have it look at that well-known place, and if it says there that it doesn't need to run, immediately exit.