A simple solution is
nohup php script.php &
So you run script in background and disconnect the process from the terminal. If it doesn't help, try
disown command after it. There is a good answer with detailed explanation of differences between these commands.
To get full control of your script, a good choice would be a
System V init script. There is a template at https://github.com/fhd/init-script-template, which you can use.
Copy template to
/etc/init.d directory and rename it. In template you need to change variables:
cmd="nohup php script.php"
Doing that you will be able to control your script by
Make sure you have permissions to write in
/var/run/, or run script as