You have to meet certain requirements in order to buy a firearm in Pennsylvania which applies to Philadelphia. You cannot buy a firearm if youAre under 18 years old for a long gun (PA law) or under 21 years old for a hand gun (Federal law);Have been convicted of a violent crime (felony or misdemeanor);Are an undocumented immigrant;Are declared mentally ill by the court;Are a drug addict or habitual drunkard;Are a fugitive from justice;Have been convicted of three separate DUI charges within a five-year period; orAre subject to an active protection from abuse order.If you meet the qualifications, you go to a gun store, fill out an application, pay the fee for a background check, and wait for the results - which could take minutes depending upon the type of firearm you are purchasing.You can also purchase a firearm at a gun show or privately. At the gun show, if the dealer is federally licensed, the same procedure applies as at the gun shop. If you purchase a handgun from someone who is not licensed, you need to go to a federally licensed dealer to transfer ownership. Fees and background checks apply. Apparently long guns can be purchased privately without a background check.After purchase, you need to abide by the laws regarding transport or carry of the firearms. In Philadelphia, there is no open carry allowed. In Pennsylvania, you must have a concealed carry license to carry or transport a loaded weapon. If you do not have a CCL and want to transport your firearm to a range, the weapon and the ammunition must be in separate containers.There are a number of online resources explaining the gun laws. You should apply due diligence to make sure you are up-to-date on the current rules for your locale. Please see some links in the discussion comments for webpages covering the subject.