Extensive research has been done on porous silicon (PS) and its applications in optoelectronics since the discovery of its light emitting properties. Porous silicon technology is also used for silicon micro machining. However, porous films can be seriously strained and this often causes mechanical curling, fracture and device failures. In the present study an optical apparatus based on substrate curvature method was developed for intrinsic stress measurement of thin films, which offered a lot of advantages as overall field, non-contact, high precision, nondestructive, easy operation and quick response. Using the apparatus, the residual stress in porous silicon layers prepared by electrochemical etching was obtained. The residual stresses in the films were determined by measuring the curvature of the Si substrate before and after etching. It is found that the residual tensile stress tends to increase with the porosity increasing and the doping concentration of the silicon wafer increasing. The results show that there is a deep connection between the microstructure PS and the residual stress distribution.