rohit
rohit

Reputation: 1

base directory of script

i am making twitter application when i call callback.php it shows some error here is some part of my callback.php where i think it has some problem

////// First establish base directory for app
define('QA_BASE_DIR', dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME']).'/../../');

$qainc=$_SERVER['DOCUMENT_ROOT'] . '/qa-include';        //second

$piinc=$_SERVER['DOCUMENT_ROOT'] . '/qa-plugin';

/* Start session and load lib */
session_start();

require_once $piinc. '/twitter-oauth-login/twitteroauth/twitteroauth.php';
require_once $piinc. '/twitter-oauth-login/config.php';

i want my directory url so i write second line www.domain.com/qa-plugin ----- i want this url but this command return this address "/usr/local/apache/htdocs/qa-include" how to correct error please help me out....

Upvotes: 0

Views: 52

Answers (3)

Joby Joseph
Joby Joseph

Reputation: 2277

Change $_SERVER['DOCUMENT_ROOT'] to $_SERVER['SERVER_NAME']

Upvotes: 0

Starx
Starx

Reputation: 79069

getcwd(); //returns the current directory

More info

Upvotes: 1

azat
azat

Reputation: 3565

See

$_SERVER['HTTP_HOST']

More verbose http://php.net/manual/en/reserved.variables.server.php

Upvotes: 0

Related Questions