Ibuprofen is a well known medicine. You can use these medicines while you feel pain in your stomach. No need to get a prescription. But if you take Ibuprofen in an empty stomach then it will be dangerous for you. Before taking Ibuprofen you need to break your fast first.
Ibuprofen on an empty stomach is dangerous. I also suggest before taking any medicine you need to consult your doctor too.