An optimal control problem forsemilinear parabolic partial differential equations is considered.The control variable appears in the leading term of the equation.Necessary conditions for optimal controls are established by themethod of homogenizing spike variation. Results for problems withstate constraints are also stated.