Check if PHP is installed on Apache or IIS Server?

后端 未结 5 1927
心在旅途
心在旅途 2020-12-10 02:35

Is there a way to check if PHP is installed on an Apache or IIS server within the PHP environment itself?

If so, how?

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 03:28

    I don't know with what PHP version it became available, but try this:

    if( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) 
      echo 'Have Apache';
    else
      echo 'Have some other server';
    

提交回复
热议问题