You're trying to execute PHP directly on the command line without using the PHP packaging, so the bash shell is attempting to execute it and doesn't recognize the PHP function.
You need to run shell_exec() in a PHP file or use the appropriate PHP CLI syntax. For example, you can pass -r to the php command, which allows you to run code.
myusername:~$ php -r 'echo shell_exec("pwd");'
/home/myusername
myusername:~$
Or you can use the built-in REPL.
myusername:~$ php -a
Interactive shell
php > echo shell_exec('pwd');
/home/myusername
php >
Also note the use of echo here since the successful result will return a string that we want to see.
shell_execis a PHP function, why are you trying to run it without PHP?