How to add a php custom page to WordPress

Please refer to the Page Templates section of the Static Pages Codex entry.

Essentially, you create a custom page template, named something like template-foobar.php, which will live in your Theme’s root directory, or in a one-deep sub-directory.

Inside this template file, add the following:

<?php
/**
 * Template Name: Foobar
 */

get_header();

// YOUR CUSTOM PHP GOES HERE

get_footer();
?>

Now your template is available to be assigned to any static Page you create.