Well, at the most basic, you have to add a profile for the owner of the web server process to /etc/sudoers.
This opens up many security related problems though so make sure you read up on the subject before opening up your server too much.
Once you've got sudoers configured, you'll be able to issue shell commands as root from within your php apps through back-ticks, exec and etc. ie.
sudo <command>