Jump to content

Movabletype Missing Mt-config.cgi


TCH-James

Recommended Posts

With some newer environments, MT seems to become confused in finding it's own location. The following error is quite common:

>Got an error: Error opening file '/mt-config.cgi': No such file or directory

 

This issue seems to crop up due to the way that MT tries to configure it's path. A one stop fix for this is to hardcode the path so that MT know how to find it's configuration files. This fix will ensure that all functions continue to work afterwards

 

Edit lib/MT/Bootstrap.pm. The first section is where we will add the fix:

 

>sub BEGIN {
my ($dir, $orig_dir);
require File::Spec;
if (!($dir = $ENV{MT_HOME})) {

 

after the "sub BEGIN" statement, insert the hard coded path:

>sub BEGIN {
$ENV{'MT_HOME'} = '/home/<username>/public_html/mt';  <-- this line should be added
my ($dir, $orig_dir);
require File::Spec;
if (!($dir = $ENV{MT_HOME})) {

 

You may have to adjust the previous line if your MT path resides elsewhere, such as /home/<username>/public_html/cgi-bin/mt.

 

If you're uncomfortable editing this file or would like some assistance, please open a ticket with the help desk and we'll be happy to help.

Link to comment
Share on other sites

  • 1 month later...

Actually, the problem is in the Perl install, specifically in File::Spec::rel2abs. You can demonstrate this by putting the following Perl script in your cgi-bin directory under the name "bug1.cgi". It will fail, demonstrating that File::Spec::rel2abs returns an invalid path when passed a valid one. That's broken.

>#!/usr/bin/perl -w

use CGI qw(header);
use File::Spec;

print header;

my $path = "./bug1.cgi";

if (! -r $path) {
   print "Unable to access file for testing.\n";
} else {
   # $path is a valid path, because it is readable.
   my $apath = File::Spec->rel2abs($path);
   print "Testing File::Spec::rel2abs on '$path' [$apath]: ";
   if (! -r $apath) {
		  print "failed\n"; # yet we can't read the path returned by rel2abs.
   } else {
		  print "succeeded\n";
   }
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...