I have an Ubuntu 10.04 server and want a perfect/optimal installation.
After installing Apache, should I install MySQL Server next or PHP next? Does it matter? Will there be any errors if I go either way? Are there any dependencies on the other being installed first?
It doesn’t matter. As long as Apache is installed before the PHP package then you are good to go. (Because when you install the PHP package some distributions do some auto-configuring with Apache).