Hold the phone! Maybe I didn't read this right, but you basically want php to call an executable. I don't think you meant call a php function from your c++ source code.
c++ or not, you still have to compile that c++ code to a binary. This shouldn't be different than calling any other binary (ping, wget, lynx, cat, etc.)
Note: The script will run in the web server's user environment. So be sure to give the entire path:
shell_exec( '/bin/cat' );
Don't forget to make your binary executable:
$ sudo chmod +x /usr/local/bin/your_binary
I have been using *nix for several years now. Maybe I'm missing something again but:
shell_exec( --t a5-$username );
The "--t" part is confusing can you enlighten me on that?