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 302 views
1 answer 92 views
1 answer 109 views
2 answers 181 views
181 views asked Dec 4, 2023 by avibootz
2 answers 274 views
274 views asked Jul 10, 2014 by avibootz
...