PHP doesn't expand ~ to home when doing file operations