If I take a photo with a camera it stores the orientation/angle of the apparatus so when I view the image on the PC with a good app, it shows auto-rotated to 0.
But
The rotation flag is stored as part of the EXIF data (see this article for more info).
You will need to read the rotation flag from the EXIF data in PHP and then rotate the image to suit. There are a variety of PHP EXIF libraries, if you have the web server set up with the extension installed you would be able to use the PHP provided library.
I would suggest rotating the image once on upload (e.g. using the GD library - most PHP installations these days seem to come with it), so that you don't need to worry about clearing the EXIF rotation data (not sure how easy this is with PHP, I've never tried it).