The unfortunate irony is that just as the coughing becomes painful, it also becomes a lot more common!
As with many other types of infection, infection of the alveoli can also cause seeping and pus. This can in turn cause the build-up of those fluids on the inside of the lungs, making it difficult to breathe.
As such, you may feel the urge to cough and thus clear the lungs of the phlegm and mucus. One of the easiest signs to potentially identify this as pneumonia versus other conditions that cause coughing is that you may find there to be phlegm or other fluids being brought up as you cough.
Phlegm is further created as the body attempts to drive out the infection. This is the same reason we experience phlegm when we have the flu or cold. It isn’t caused by the bacteria itself, but rather by the body trying to drive it out.
Similarly, you might find that you have a slight rattling sound as you breathe. This is caused by the phlegm and fluid moving around inside the lungs and the airways.