For me, the best way of executing command is to let your php script inserts command name into a mysql database and create a PERL script that will regularly check if new entry has been made by the PHP script. If it finds one, i'll execute the command specified... make sure the PERL itself is running as a root. To make your Perl script run forever, insert an entry on the CRONTAB...
your PERL script should at least be in this form
#!/usr/bin/perl
while () { # loop forever
..
.... do the processing..
..
} #while