If a photon has no mass, how can it be attracted by the Sun? I read that the photon doesn't have mass, but my teacher says that the photon has mass  because the sun can attract it (like in the experiments to prove the theory of relativity).
I think that there is another reason to explain that. How can I explain that the photon doesn't have mass and the sun attracts photons?
 A: To properly understand what is going on you need to understand general relativity. Massless particles, like photons, travel on null geodesics and mass bends spacetime so the null geodesics are not straight lines. The problem is that neither you nor your teacher understand general relativity so this isn't a very convincing argument. But here is an argument to show photons are attracted by gravity even in Newtonian gravity.
If you have a large mass $M$ attracting a small mass $m$ and the distance between the two masses is $d$ then the force between them is given by Newton's equation:
$$ F = \frac{GMm}{d^2} $$
To get the acceleration $a_m$ of the small mass $m$ we use Newton's second law $F = ma$ so:
$$ a_m = \frac{F}{m} = \frac{GMm}{md^2} = \frac{GM}{d^2} $$
Note that the mass of the small object has cancelled out, so the acceleration doesn't depend on $m$ at all. That means a massless object like a photon experiences exactly the same acceleration as a massive object. So even in Newtonian gravity we expect the path of a light ray to be deflected by gravity. In fact with some head scratching the equation for the expected deflection can be derived, and it is:
$$ \theta_{Newton} = \frac{2GM}{c^2d} $$
where $d$ is the distance of closest approach and $\theta_{Newton}$ is the angle that the light ray is bent.
As I mentioned at the start, to properly describe the light ray you need general relativity and using this we find that the deflection is actually twice as big as Newtonian gravity predicts:
$$ \theta_{GR} = \frac{4GM}{c^2d} $$
A: What you read is correct. I am not sure if those were the exact words of your teacher but according to the general theory of relativity, sun doesn't "attract" the photon (or any other body for that matter). In fact gravity is not even a real force.
Let me briefly state what the theory of relativity has to say about gravity without going into the complicated mathematics. Imagine you try to measure the distance between two points on the surface of the earth. generally, the shortest distance between two points is a straight line. But because earth is a sphere (more or less) and hence the surface is "curved", the shortest distance between two points is not really a straight line. In fact, you can never draw a straight line on a curved surface.
Mr. Einstein says that just like the two dimensional earth surface has a geometry, the four dimensional "spacetime" also has a geometry. the geometry of spacetime is generally flat but in the vicinity of an object with substantial mass, the geometry is curved. It's the curvature of spacetime that we call gravity.
We know from classical mechanics that a moving object tends to keep moving in a straight line with a constant velocity. This is true in the theory of relativity as well but because a massive object curves spacetime, a straight line through spacetime is not always straight. When a moving object comes near a massive body, it falls into the curved region and therefore bends towards it and appears to be "attracted" by it.
Hope this answers your question.
