tim_perrett Posted August 20, 2007 Share Posted August 20, 2007 Hey chaps Is there a way to dynamically work out what platform your on? As I have a function that I either need to pass '/' for *nix systems, and '\\' for win32 boxes yet there doesnt seem to be an easy way to do this? Any suggestions people? Cheers Tim Quote Link to comment https://forums.phpfreaks.com/topic/65837-solved-determine-what-server-platform-your-deploying-on/ Share on other sites More sharing options...
Daniel0 Posted August 20, 2007 Share Posted August 20, 2007 You can use php_uname('s'); to determine the server OS. Note that there is a built in constant called DIRECTORY_SEPARATOR which contains the directory separator for the server OS (i.e. \ for Windows and / for Unix). Quote Link to comment https://forums.phpfreaks.com/topic/65837-solved-determine-what-server-platform-your-deploying-on/#findComment-328991 Share on other sites More sharing options...
tim_perrett Posted August 20, 2007 Author Share Posted August 20, 2007 Ahh excellent Cheers Tim Quote Link to comment https://forums.phpfreaks.com/topic/65837-solved-determine-what-server-platform-your-deploying-on/#findComment-329027 Share on other sites More sharing options...
dbo Posted August 20, 2007 Share Posted August 20, 2007 I've always coded under the assumption that it would be deployed on *nix. Making sure that I consider everything case sensitive and using *nix paths (/). Windows seems to understand the forward slash just fine in my experience. Quote Link to comment https://forums.phpfreaks.com/topic/65837-solved-determine-what-server-platform-your-deploying-on/#findComment-329028 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.