Conventional phase measuring deflectometry (PMD) takes up a large measurement space and is not suitable for compact online measurement, as the liquid crystal display (LCD) has to be placed in parallel with the mirror under test. In this paper, a compact online phase measuring deflectometry (COPMD) with the LCD screen set perpendicular to the mirror under test is presented for surface shape distortion real-time measurement. The configuration of the COPMD in an enclosed laser cavity is proposed, and the principle of the method is theoretically derived by using the vector-form reflection law. Based on the analysis model, the fringe modulation regulation of the LCD is revealed, and the measurement errors caused by misalignments of the components are illustrated. The validity and flexibility of the COPMD method are verified in the experiment by using a single-actuator deformable mirror as the mirror under test and the PMD method as the comparison. The proposed COPMD method remarkably expands the application range of the conventional PMD method, as it could make efficient use of compact space and is applicable for real-time measurement in enclosed laser facilities and assembled laser systems.