use php pack function to handle write_long