if [-z "$process"]
needs to have spaces:
if [ -z "$process" ]
This is almost certainly duplicated in at least 1000 different questions, but the short of it is that you are trying to invoke a command named [, but you are accidentally invoking a command named [-z which probably doesn't exist in your PATH. [ is not part of the grammar. It is a command. This would be more clear if you instead write:
if test -z "$process"
Also, you're missing a semi-colon (or a newline) before fi.
Note further that you can more easily check the status of grep by just checking it directly:
execute_php () {
if ! ps -A | grep -q php; then echo "no php running"; fi
}
And further note that this would probably be better if it returned non-zero if the desired process is not running:
execute_php() {
if ! ps -A | grep -q php; then echo "no php running" >&2; return 1; fi
}
But, honestly that's too verbose (and the name of the function seems wrong. You're not executing anything.) IMO, you should just write:
check_php() {
ps -A | grep -q php
}
and then callers can do if check_php; then ....