A colleague recently came to me with this issue that worked fine in their browser, but not on the command line:

Warning: include(../config.php): failed to open stream: No such file or directory

This warning appeared because of the current working directory.

When accessing this script via the browser, Apache found the correct path to the file and so '../' was relative to it's own directory.

However by running it from a command line...

php /var/www/public/index.php

The current working directory was actually wherever the user is in the file system of the server.

In which case they could do:

cd /var/www/public/
php index.php

Better yet, they could use the __DIR__ magic constant in PHP which returns the directory of the file itself.

<?php
include(__DIR__ . '/../config.php');

If you ever need to figure out the current working directory, you can use the nifty function getcwd().