If that's what you meant, the way to do it from PHP with ImageMagick is:
system("convert -rotate '$degree' '$path'/'$rotate' '$path'/'$rotate' 2>&1 &");
To use the system() you'll need either to have safe mode off, or setup a safe directory in the php.ini file for save commands to run.
And with this example, I was allowing user input to determine the degree of rotation.