What are common pitfalls when setting up PHP scripts on a local server and how can they be avoided?

One common pitfall when setting up PHP scripts on a local server is incorrect file paths. To avoid this issue, always use absolute file paths or ensure that relative paths are correctly referenced based on the file's location.

// Incorrect relative file path
include 'includes/config.php';

// Corrected absolute file path
include $_SERVER['DOCUMENT_ROOT'] . '/includes/config.php';