I have the following directory structure.
/var/www/base/controller/detail.php
/var/www/base/validate/edit.json
/var/www/html
Within /
Of cause there is the possibility to use the include_path parameter. Set this parameter to '1' then a search for the file in the include_path (in php.ini.) will be done. You have to do editing in the php.ini!
When using $json=file_get_contents('detail.php'); a call is done from a php file. Use file_get_contents('detail.php'); to have the detail.php get executed. the file have to be in the root directory (same as the calling php file in which the file_get_contents() is situated). If detail.php is in a subdirectory i can not see any workaround than using the include_path parameter