Polymer/nanocrystal bulk heterojunction photovoltaic cells have attracted substantial interest because the hybrid active layer combines the advantages of inorganic materials and polymers. In this work, a porous TiO2 was prepared via the sol-gel method with a polyethylene glycol 2000 (PEG2000) template. A kind of polymer/inorganic solar cell based on poly (3-hexylthiophene) (P3HT)/TiO2 was fabricated on the indium-tin-oxide (ITO) glass substrate and the structure of device was ITO/TiO2/P3HT/Au. The device showed the performance with a short circuit current (J(SC)) of 1.29 mA/cm2, an open circuit voltage (V(OC)) of 0.55 V and a fill factor (FF) of 28.7%.