faheemhameed Posted July 25, 2006 Share Posted July 25, 2006 Hi there,I have set an alias in the apache conf as follows:Alias /my_root/ "D:/Apache/hameed/"My Apache root "/" folder is "D:/Apache/"Now I have created test.php in the folder "D:/Apache/testing/". The content is as follows:<?print realpath("/my_root");?>The output is blank instead of "D:/Apache/hameed/"Please help me and let me know what I am missing here.Thanks!!Hameed Quote Link to comment https://forums.phpfreaks.com/topic/15570-realpath-ing-alias-folder/ Share on other sites More sharing options...
wildteen88 Posted July 25, 2006 Share Posted July 25, 2006 This is because PHP doesnt send a request through to Apache, to retrive info on a directory/file, include/requiring a file etc or when dealing with files/folders. PHP uses its own request to do this. So if you tell PHP to go to /my_root, it'll goto the root of your hard drive and look for a file//folder called my_root, it wont use the apache alias you setup as it isn't sending a reguest through to apache. Quote Link to comment https://forums.phpfreaks.com/topic/15570-realpath-ing-alias-folder/#findComment-63315 Share on other sites More sharing options...
faheemhameed Posted July 25, 2006 Author Share Posted July 25, 2006 Hi there,Thanks for your reply. But how can I work around my issue? It is possible at all? Quote Link to comment https://forums.phpfreaks.com/topic/15570-realpath-ing-alias-folder/#findComment-63341 Share on other sites More sharing options...
wildteen88 Posted July 25, 2006 Share Posted July 25, 2006 Note really. Unless you setup a constent called MY_ROOT, which has the value of D:/Apache/hameed/ like so:[code]define('MY_ROOT', 'D:/Apache/hameed/');echo MY_ROOT;[/code]When creating/using constants they must be in uppercase.Then when you want to use MY_ROOT you do this:[code]echo realpath(MY_ROOT);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15570-realpath-ing-alias-folder/#findComment-63396 Share on other sites More sharing options...
faheemhameed Posted July 26, 2006 Author Share Posted July 26, 2006 Thanks!!I understand this. Quote Link to comment https://forums.phpfreaks.com/topic/15570-realpath-ing-alias-folder/#findComment-63746 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.