这是我的一段代码
<?php
require_once ($_SERVER['DOCUMENT_ROOT'].'/Search/google-api-php-client/src/Google_Client.php');
require_once ($_SERVER['DOCUMENT_ROOT'].'/Search/google-api-php-client/src/contrib/Google_YouTubeService.php');
?>
当我在浏览器上运行此操作时,它会给出内部服务器错误500。 我的目录结构是
/Search/index.php
/Search/google-api-php-client/src/Google_Client.php
/Search/google-api-php-client/........all the api file
apache日志文件说
"GET /Search/ HTTP/1.1" 500 276 "-" "Mozilla/5.0 (X11; Linux i686)
AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116
Chrome/34.0.1847.116 Safari/537.36"
请帮助我,我被困在我的代码中。 提前谢谢。
答案 0 :(得分:0)
试
define('__ROOT__', dirname(dirname(__FILE__)));
echo __ROOT__; // add file location according this.
require_once(__ROOT__.'/Search/google-api-php-client/src/Google_Client.php');
阅读手册: - http://www.php.net/manual/en/function.require-once.php