if you are just a users among the 100s of users on a hosting machines, then if you do a include("/main.php"); it won't include the file but will say Failed opening required '/main.php' (include_path='.:/usr/local/nf/ lib/php') it seems ok to include("../main.php"); except the file will not work if moved from www.abc.com/movies to a new location of www.abc.com/movies/little-mermaid is there a better solution for this?
You should store a variable in your app with the absolute path. You can use $_SERVER['DOCUMENT_ROOT'] and $_SERVER['PHP_SELF'] to find it automatically (so you don't have to change a config file every time you move server or put the app in a new directory).
^^ What he said. Alternatively, I use something similar to the form: include( basedir(__FILE__) . '../main.php' ); which determines the directory that the current file is in and then uses the 'relative' portion of the path to create an absolute path.