With GNU findutils, and a shell with support for process substitution (ksh, zsh, bash), you can do:
xargs -r0a <(locate -0 php.ini) vi
The idea being to pass the file list via a -a filename rather than stdin. Using -0 makes sure it works regardless of what characters or non-characters the file names may contain.
With zsh, you could do:
vi ${(0)"$(locate -0 php.ini)"}
(where 0 is the parameter expansion flag to split on NULs).
However note that contrary to xargs -r that still runs vi without argumentsargument if no file is found.