In the present work, the effects of hydrostatic pressure, temperature, and magnetic field on the nonlinear optical rectification (OR) and second-harmonic generation (SHG) in asymmetrical Gaussian potential quantum well (QW) have been investigated theoretically. Here, the expressions for the optical properties are calculated by the compact-density-matrix approach and iterative method. Simultaneously, the energy eigenvalues and their corresponding eigenfunctions have been obtained by using the finite difference method. The energy eigenvalues and the shape of the confined potential are modulated by the hydrostatic pressure, temperature, and magnetic field. So the results of a number of numerical experiments indicate that the nonlinear OR and SHG strongly depends on the hydrostatic pressure, temperature, and magnetic field. This gives a new degree of freedom in various device applications based on the intersubband transitions of electrons.