Use safer PHP alloc/free functions