Phew is a vocalic gesture expressing weariness, relief, surprise, or release. Most properly, it is a gasp or strong sigh produced with rounded lips. If you were to treat it as an onomatopoeic word, it would be pronounced 'fyoo' (IPA /fju/), but most properly it is not a spoken word, and the written word phew should be treated as a non-phonetic representation.
Phew was first seen in print in 16031, where it was written as pheut. By 1633 the spelling phew had appeared, although throughout the years many variations have been attempted, including phu, phugh, pho, phoo, and pfew. It is possible that the strange (and strangely consistent) use of the 'ph' digraph in an attempt at onomatopoeia is due to 'ph' descending from the Greek letter phi (ɸ), which in later centuries (~200 BCE) had come to represent the sound made by blowing through one's lips (a bilabial spirant). However, this is not a clear connection, merely a supposition. It is interesting to note that nearly every other word in English that uses 'ph' to make the 'f' sound comes from a Greek root2, making phew a rarity.
1. In John Marston's The Malcontent; this work was latter 'edited' by John Webster, and it is unclear which parts are written by whom.
2. Other exceptions include (and may indeed be limited to) nephew, pheon, philibeg (usually spelled filibeg), Pharisee (a Hebrew word coming to us through Greek translations), and phat (a silly bit of slang).