The attempt to understand copper oxide superconductors is complicated by the presence of multiple strong interactions in these systems. Many believe that antiferromagnetism is important for superconductivity, but there has been renewed interest in the possible role of electron-lattice coupling. The conventional superconductor MgB2 has a very strong electron-lattice coupling, involving a particular vibrational mode (phonon) that was predicted by standard theory and confirmed quantitatively by experiment. Here we present inelastic scattering measurements that show a similarly strong anomaly in the Cu-O bond-stretching phonon in the copper oxide superconductors La(2-x)Sr(x)CuO4 (with x = 0.07, 0.15). Conventional theory does not predict such behaviour. The anomaly is strongest in La(1.875)Ba(0.125)CuO4 and La(1.48)Nd(0.4)Sr(0.12)CuO4, compounds that exhibit spatially modulated charge and magnetic order, often called stripe order; it occurs at a wave vector corresponding to the charge order. These results suggest that this giant electron-phonon anomaly, which is absent in undoped and over-doped non-superconductors, is associated with charge inhomogeneity. It follows that electron-phonon coupling may be important to our understanding of superconductivity, although its contribution is likely to be indirect.