The instructions for compiling from source on Linux are described in the PHP manual.