fix bug and improve compatibility

- Fix the str_endswith function;
- Change fpassthru function to some thing more compatible with some low
cost servers;