Fix php cli (-S option) inconsistent port parsing

Add port range verification of listening port with -S option for the php cli.
This fixes inconsistent listening port due to unverified cast from long to short
with htons(3).