I have a form that saves the information in the database and that takes me less than 1 second and shows a thank you, but I want to send that information by PhpMailer to 5 people, that takes me 18 seconds to finish loading the page and show appreciation.
So I thought to make it just show the thanks and execute the PHP file, in the background you could say, but I have to send it 2 variables.
I saw on the internet solutions using shell, but isn't there another simpler way?
You could close the connection, causing the client to receive the information, but keep the script running. It is explained in the manual: Handling connections .
Code: