The explosive reaction depends on the amount of gas dissolved in the magma and its viscosity.
Low-viscosity magmas allow gases to easily escape to the surface, reducing the likelihood of an explosive release. While high viscosity magnets retain the gases and increase the pressure producing a greater probability of an explosive release occurring.
This magma when it reaches high pressures and when it overcomes the resistance it encounters, escapes violently, giving rise to an explosive eruption.