Geometric and electronic properties of porphyrin molecules on Au(111) and NaCl surfaces