johnwayne77 Posted December 21, 2006 Share Posted December 21, 2006 [b]i want to put in a variable the full server path of the script I'm running.[/b]something like that:[color=green]$variable = '/home/joe/www/site/'[/color]I have mannged only to echo the script name itself.I need this for a script I'm using which uses a cookie file. Here is the code:[color=green][font=Verdana][font=Verdana]//$cookie_file_path = "/usr/local/psa/home/vhosts/xxx.com/httpdocs/test/cookie.txt"; // Please set your Cookie File path//[/font][/font][/color]thanks Link to comment https://forums.phpfreaks.com/topic/31485-solved-finding-the-full-server-path-of-the-script/ Share on other sites More sharing options...
Orio Posted December 21, 2006 Share Posted December 21, 2006 It's as simple as $_SERVER['SCRIPT_FILENAME'] :)Orio. Link to comment https://forums.phpfreaks.com/topic/31485-solved-finding-the-full-server-path-of-the-script/#findComment-145839 Share on other sites More sharing options...
johnwayne77 Posted December 21, 2006 Author Share Posted December 21, 2006 I have tried this code, but nothing shows up on the screen:[code]<?$var = $_SERVER['a.php'];$dir = dirname($var);echo $var;?>[/code]what do i do wrong? Link to comment https://forums.phpfreaks.com/topic/31485-solved-finding-the-full-server-path-of-the-script/#findComment-145846 Share on other sites More sharing options...
Orio Posted December 21, 2006 Share Posted December 21, 2006 $_SERVER['SCRIPT_FILENAME'] is what you need, dont change anything in it :)[code]<?phpecho dirname($_SERVER['SCRIPT_FILENAME']); //No need to change anything here?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/31485-solved-finding-the-full-server-path-of-the-script/#findComment-145858 Share on other sites More sharing options...
johnwayne77 Posted December 21, 2006 Author Share Posted December 21, 2006 great!thanks dude, it works. Link to comment https://forums.phpfreaks.com/topic/31485-solved-finding-the-full-server-path-of-the-script/#findComment-145870 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.