• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5213: SCRIPTNAME not defined when using Sun One Web Server

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal New   major  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


I just installed version 4.1.2 to upgrade a 4.0.4 TWiki web site. Everything woked ok except for links within a page were incorrectly formated. The script name was not present in the link. I traced this back to the environment variable SCRIPT_FILENAME not being set by my web server.

The web server I have to run on is a Sun ONE Web Server/6.1 . The server does not seem to define SCRIPT_FILENAME or SCRIPT_URL. I modified TWiki.pm to display the environment variables that are defined and I found that the environment variable SCRIPT_NAME is defined.

The environment variable SCRIPT_NAME was defined with the contents "/~philip/twiki/bin/view.cg".

This problem does not exist in the 4.0 version of the TWiki software, but does exist for all versions of 4.1 and the 4.2 release candidate.

To fix the problem, I modifed the _SCRIPTNAME subroutine in TWiki.pm to add the following lines after the check for SCRIPT_FILENAME.

     $value = $ENV{SCRIPT_NAME};
    if( $value ) {
        $value =~ s!.*/([^/]+)$!$1!o;
        return $value;

The variable SCRIPTNAME is now defined to be view.cgi and the base href in the web page is now correct.

The TWiki 4.2 version seems to work differently. It seems to want SCRIPTNAME to not contain the script suffix. To fix that version, I had to use the following code

     $value = $ENV{SCRIPT_NAME};
    if( $value ) {
        $value =~ s!.*/([^/]+)$!$1!o;
        if ( $TWiki::cfg{ScriptSuffix} ) {
          my $suffix = $TWiki::cfg{ScriptSuffix};
          $value =~ s|$suffix$|| if ($suffix);
        return $value;If the script suffix was not removed, the software seemed to add an additional suffix.

The above problem in version 4.2 may be related to Item5176.

Other configuration information from the Web server is:

HTTP_USER_AGENT=Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv: Gecko/20071030 SeaMonkey<a rel="nofollow" href="http://wwwin/%7Ephilip/twiki/bin/edit.cgi/Sandbox/SeaMonkey?topicparent=Sandbox.TocPage" title="Create this topic">?</a> /1.1.6
The previous bug report, Item3588, to fix a similar problem did not make any difference to my situation.

-- TWiki:Main/PhilipSchmidt - 06 Jan 2008

Although imprtant, this is not a release blocker for the 4.2.0 release. Per release meeting, reprioritized to normal.

-- TWiki:Main.PeterThoeny - 07 Jan 2008

FWIW this problem also exists on IIS 5 as well

-- TWiki:Main.AndrewMould - 14 Jan 2009

Same problem here, with Sun Web Server 7.0U3. Please fix!

-- TWiki:Main.IainMacDonnell - 21 Jan 2009

Summary SCRIPTNAME not defined when using Sun One Web Server
ReportedBy TWiki:Main.PhilipSchmidt
Codebase 4.1.1, 4.1.2, 4.2.0
SVN Range TWiki-4.1.1, Mon, 05 Feb 2007, build 12770 - TWiki-4.2.0-rc2, Mon, 10 Dec 2007, build 15958
AppliesTo Engine

Priority Normal
CurrentState New


TargetRelease major

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r5 - 2009-01-21 - IainMacDonnell
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback