Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Friday 4 March 2016

How To Fix Call to undefined function apache_get_modules()



Fatal error:  Call to undefined function apache_get_modules() in
apache_get_modules() is only available when the PHP is installed as a module and not as a CGI. This is the reason why you cannot use this function and suffering from the error . The other reason would be caused by the disable_functions directive in your php.ini . you can use the following written php code to check whether rewrite module is enabled or not in your case while using CGI server API

<?php
if (is_mod_rewrite_enabled()) {
  print "The apache module mod_rewrite is enabled.<br/>\n";
} else {
  print "The apache module mod_rewrite is NOT enabled.<br/>\n";
}

/**
 * Verifies if the mod_rewrite module is enabled
 *
 * @return boolean True if the module is enabled.
 */
function is_mod_rewrite_enabled() {
  if ($_SERVER['HTTP_MOD_REWRITE'] == 'On') {
    return TRUE;
  } else {
    return FALSE;
  }
}
?>

To Check whether you are running Php Under CGI or Apache you can use procedure below
Create a check_phpinfo.php file and Write PHP Code Written Below -
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>
Then the file and Navigate to Url like - www.example.com/check_phpinfo.php and It will show you php file in server
In Four line you can see "Server API CGI/FastCGI" That Denotes you are using PHP under CGI / Fast CGI