How to determine the server operation system (os) with PHP

2 Answers

0 votes
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') 
    echo 'Server using Windows';
else 
    echo 'Server not using Windows';


/*
run:
    
Server using Windows 
       
*/

 



answered Jul 14, 2016 by avibootz
0 votes
if (strtoupper(substr(PHP_OS, 0, 3)) === 'Linux') 
    echo 'Server using Linux';
else 
    echo 'Server not using Linux';


/*
run:
    
Server not using Linux 
       
*/

 



answered Jul 14, 2016 by avibootz

Related questions

2 answers 432 views
1 answer 182 views
1 answer 205 views
2 answers 281 views
281 views asked Dec 4, 2023 by avibootz
2 answers 397 views
397 views asked Jul 10, 2014 by avibootz
...