If you DO really feel the need to grep the output of ps, beware of your grep finding itself.
[ghoti@pc ~]$ sleep 60 &
[1] 66677
[ghoti@pc ~]$ ps aux | grep sleep
ghoti 66677 0.0 0.0 3928 784 11 S 4:11PM 0:00.00 sleep 60
ghoti 66681 0.0 0.0 16440 1348 11 S+ 4:12PM 0:00.00 grep sleep
[ghoti@pc ~]$
There's an easy way to avoid this. Just make part of your grep into a more complex regular expression.
[ghoti@pc ~]$ sleep 60 &
[2] 66717
[ghoti@pc ~]$ ps aux | grep '[s]leep'
ghoti 66677 0.0 0.0 3928 784 11 S 4:11PM 0:00.00 sleep 60
ghoti 66717 0.0 0.0 3928 784 11 S 4:13PM 0:00.00 sleep 60
[ghoti@pc ~]$
On the other hand, if you just want to make sure that your PHP script always runs, you can wrap it in something that re-runs it when it dies:
while true; do
php /path/to/my.php
done
If you want this to run at startup, you can edit your crontab on the server, and use a @reboot tag, assuming you're using "Vixie" cron (common on Linux and BSD):
@reboot /path/to/wrapperscript
You can man crontab and man 5 crontab for more details on how to use cron and the @reboot tag.
pgrep, it's a whole lot easier to use.