Nickel oxide and nickel co-doped graphitic carbon nitride (NiO-Ni-GCN) nanocomposites were successfully prepared by thermal treatment of melamine and NiCl2 6H2O. NiO-Ni-GCN nanocomposites showed superior electrochemical catalytic activity for the oxidation of octylphenol to pure GCN. A detection method of octylphenol in environmental water samples was developed based at NiO-Ni-GCN nanocomposites modified electrode under infrared light irradiation. Differential pulse voltammetry was used as the analytic technique of octylphenol, exhibiting stable and specific concentration-dependent oxidation signal in the presence of octylphenol in the range of 10nM to 1μM and 1μM to 50μM, with a detection limit of 3.3nM (3S/N). © 2016 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim.