Large numbers on Linux CentOS

I wrote a script in php that would count number, but when it reached about 64,000-65,000, server gave me internal server error. I think the reason was due to number going over the max integer limit. What kind of variable declaration should I do to overcome that limit in php?

Thanks.