Guest convention Posted December 23, 2006 Share Posted December 23, 2006 Hello,What can I do so $_SERVER['SCRIPT_FILENAME'] outputs a URL like '/Users/andrew/Sites/mywebsite/' instead of '/Users/andrew/Sites/mywebsite/filename.php'?Thanks! Link to comment https://forums.phpfreaks.com/topic/31672-solved-modifying-_serverscript_filename/ Share on other sites More sharing options...
Orio Posted December 23, 2006 Share Posted December 23, 2006 Use [url=http://www.php.net/manual/en/function.dirname.php]dirname()[/url] :)[code]$dir = dirname($_SERVER['SCRIPT_FILENAME'])."/";[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/31672-solved-modifying-_serverscript_filename/#findComment-146831 Share on other sites More sharing options...
Guest convention Posted December 23, 2006 Share Posted December 23, 2006 Ah, thank you. But I realized I need something like DOCUMENT_ROOT. If I have a script located in '~/Sites/mysite/' which echoes DOCUMENT_ROOT, then it displays just '~/Sites/'. I need it so it displays '~/Sites/mysite/' even if the script is in a subfolder of 'mysite' (ex: if the script is located in '~/Sites/mysite/subfolder/' it will still echo '~/Sites/mysite/').Is that possible? Link to comment https://forums.phpfreaks.com/topic/31672-solved-modifying-_serverscript_filename/#findComment-146968 Share on other sites More sharing options...
Orio Posted December 23, 2006 Share Posted December 23, 2006 I tried this using a few sub folders and it displays everything...Orio. Link to comment https://forums.phpfreaks.com/topic/31672-solved-modifying-_serverscript_filename/#findComment-146989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.