Strip the NULL that PHP no longer strips

As of PHP 5.5.0, unpack("a", ...) no longer strips the NULL byte from
the end of the string. A new format specifier, Z, was introduced to
perform the old behavior, but we don't have a good way to test for its
existence. Instead, just remove it with str_replace
Close the server socket in php bind stager

This was previously left dangling, which leaves the port open, but
doesn't do anything with subsequent connections.
Land #3491, @jlee-r7's fix for php meterpreter on php 5.5.0
Land all the commits on #3491, @jlee-r7's patch for php meterpreter