A comprehensive investigation of electrocoagulation using sacrificial titanium (Ti) electrodes in wastewater was carried out. The effects of specific process variables, such as initial pH, mixing, current density, initial organic loading, and ionic/electrolyte strength were first optimized to produce recyclable Ti-based sludge. The sludge was incinerated at 600 °C to produce functional TiO2 photocatalyst. X-ray diffraction analysis revealed that TiO2 produced at optimum electrocoagulation conditions was mostly anatase structure. The specific surface area of the synthesized TiO2 photocatalyst was higher than that of the commercially available and widely used Degussa P-25 TiO2. Furthermore, energy dispersive X-ray and X-ray photoelectron spectroscopy analyses showed that in additional to titanium and oxygen, this photocatalyst is also composed of carbon and phosphorus. These elements were mainly doped as a substitute site for the oxygen atom. Transmission electron microscopy images exhibited sharply edged nanorods, round nanoparticles, and nanotubes with nonuniform shapes showing some structural defects. Photodecomposition of gaseous acetaldehyde by this photocatalyst was also conducted under UV and visible light irradiation to study the photocatalytic properties of the doped TiO2 photocatalyst. While no photocatalytic activity was observed under visible light irradiation, this doped TiO2 photocatalyst exhibited high photocatalytic activity under UV light.