The first piece of code directly attempts to include the file conatined in the $doc variable.
<?php include $doc;?>
The second piece of code makes a file_exists() call and depending on the result of this call, attempts to include the file.
file_exists is subject to PHP safe mode restrictions. These provide means to prevent the inclusion of specific files/directories that would otherwise be accessible. As stated in the PHP docs, PHP is not the appropriate place in the stack to enforce such restrictions, but this is a fallback mechanism should appropriate hardening and design/configuration practices not be present at the web server and/or OS level.
With the above in mind, you will be better able to perform LFI in the first code sample.