DreamPress installation ... Fatal error: Call to undefined function get_home_path()

wordpress

#1

Is DreamPress running PHP as CGI? It seems like the get_home_path() function is returning the wrong path, meaning it can’t edit the .htaccess file. The get_home_path() function’s return value is the full/absolute filesystem path to the root of the WordPress installation.

I keep getting a Fatal error that is symptomatic of a problem with DreamHost running PHP as CGI some years back. The .htaccess file was not writable by WordPress when the blog url and install url were different because $_SERVERSCRIPT_FILENAME? was returning ‘php.cgi’ instead of the script name when the site was run as CGI instead of Apache (apparently standard at Dreamhost at the time). I’m not sure if this is still the case, or if it may be the case on the server that my installation is hosted on.

Here is the error I keep getting, even after disabling plug-ins …

THIS IS WHAT IT IS REFERRING TO:

[php]$home_path = get_home_path();[/php]

which comes from this function in the misc.php file:

[php]
/**

  • Updates the htaccess file with the current rules if it is writable.

  • Always writes to the file if it exists and is writable to ensure that we

  • blank out old rules.

  • @since 1.5.0
    */
    function save_mod_rewrite_rules() {
    if ( is_multisite() )
    return;

    global $wp_rewrite;

    $home_path = get_home_path();
    $htaccess_file = $home_path.’.htaccess’;

    /*

    • If the file doesn’t already exist check for write access to the directory
    • and whether we have some rules. Else check for write access to the file.
      */
      if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
      if ( got_mod_rewrite() ) {
      $rules = explode( “\n”, $wp_rewrite->mod_rewrite_rules() );
      return insert_with_markers( $htaccess_file, ‘WordPress’, $rules );
      }
      }

    return false;
    }
    [/php]

THIS IS CALLING THE get_home_path FUNCTION IN THE FOLLOWING WP CORE FILE:

HERE IS WHERE IT CALLS IT:

[php]/**

  • Get the absolute filesystem path to the root of the WordPress installation

  • @since 1.5.0

  • @return string Full filesystem path to the root of the WordPress installation
    /
    function get_home_path() {
    $home = set_url_scheme( get_option( ‘home’ ), ‘http’ );
    $siteurl = set_url_scheme( get_option( ‘siteurl’ ), ‘http’ );
    if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
    $wp_path_rel_to_home = str_ireplace( $home, ‘’, $siteurl ); /
    $siteurl - $home */
    $pos = strripos( str_replace( ‘\’, ‘/’, $_SERVER[‘SCRIPT_FILENAME’] ), trailingslashit( $wp_path_rel_to_home ) );
    $home_path = substr( $_SERVER[‘SCRIPT_FILENAME’], 0, $pos );
    $home_path = trailingslashit( $home_path );
    } else {
    $home_path = ABSPATH;
    }

    return str_replace( ‘\’, ‘/’, $home_path );
    }
    [/php]

*** This file was missing from my installation, so I went ahead and reinstalled WordPress from the console here:

While this did put the file.php file back into the proper directory, it did not correct the problem. The same fatal error is still being thrown.

Is DreamPress in fact running PHP as CGI? … or should I be looking elsewhere to troubleshoot this problem. I’ve been hitting walls for a couple of days now and thought it best to ask.

Thanks a bunch for any light someone might be able to shed on this problem. I really appreciate it!

Sue.