How to know for sure if FastCGI is being used to run php scripts

前端 未结 8 919
被撕碎了的回忆
被撕碎了的回忆 2020-12-13 14:51

I have a hosted site and I\'m having trouble configuring Joomla (running Joomla + php + mySQL on IIS7 + win server 2008). I have a similar configuration running on a local m

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 15:53

    This worked for me.

    /**
     * return phpinfo() results as an array
     *
     * @credit http://php.net/manual/en/function.phpinfo.php#106862
     * @param void
     * @return array
     */
    function phpinfo_array(){
        ob_start();
        phpinfo();
        $info_arr = array();
        $info_lines = explode("\n", strip_tags(ob_get_clean(), '

    ')); $cat = 'general'; foreach($info_lines as $line){ preg_match('/

    (.*)<\/h2>/', $line, $title) ? $cat = preg_replace('/\s+/', '_', strtolower(trim($title[1]))) : null; if(preg_match('/]+>([^<]*)<\/td>]+>([^<]*)<\/td><\/tr>/', $line, $val)){ $subcat = preg_replace('/\s+/', '_', strtolower(trim($val[1]))); $info_arr[$cat][$subcat] = $val[2]; } elseif(preg_match('/]+>([^<]*)<\/td>]+>([^<]*)<\/td>]+>([^<]*)<\/td><\/tr>/', $line, $val)){ $subcat = preg_replace('/\s+/', '_', strtolower(trim($val[1]))); $info_arr[$cat][$subcat] = array('local' => $val[2], 'master' => $val[3]); } } return $info_arr; } // output proper response code $phpinfo = phpinfo_array(); $configure = (@isset($phpinfo['general']['configure_command'])) ?: null; // properly account for FastCGI if ($configure && preg_match('/--enable-fastcgi/', $configure)){ // fastcgi response header('Status: 403 Access is forbidden'); } else { // http response header('HTTP/1.0 403 Access is forbidden'); }

提交回复
热议问题