# Installing Bugzilla

## Installation

If you just want to use Bugzilla, you do not need to install it. None of this chapter is relevant to you. Ask your Bugzilla administrator for the URL to access it over the web.

The Bugzilla server software is usually installed on Linux or Solaris. If you are installing on another OS, check before you start your installation to see if there are any special instructions.

As an alternative to following these instructions, you may wish to try Arne Schirmacher's unofficial and unsupported Bugzilla Installer, which installs Bugzilla and all its prerequisites on Linux or Solaris systems.

This guide assumes that you have administrative access to the Bugzilla machine. It not possible to install and run Bugzilla itself without administrative access except in the very unlikely event that every single prerequisite is already installed.

The installation process may make your machine insecure for short periods of time. Make sure there is a firewall between you and the Internet.

You are strongly recommended to make a backup of your system before installing Bugzilla (and at regular intervals thereafter :-).

In outline, the installation proceeds as follows:

1. Install Perl (&min-perl-ver; or above)

2. Install MySQL (&min-mysql-ver; or above)

3. Install a Webserver

4. Install Bugzilla

5. Install Perl modules

6. Configure all of the above.

### Perl

Installed Version Test: `perl -v`

Any machine that doesn't have Perl on it is a sad machine indeed. If you don't have it and your OS doesn't provide official packages, visit . Although Bugzilla runs with Perl &min-perl-ver;, it's a good idea to be using the latest stable version. As of this writing, that is Perl &newest-perl-ver;.

### MySQL

Installed Version Test: `mysql -V`

If you don't have it and your OS doesn't provide official packages, visit . You need MySQL version &min-mysql-ver; or higher.

Many of the binary versions of MySQL store their data files in `/var`. On some Unix systems, this is part of a smaller root partition, and may not have room for your bug database. To change the data directory, you have to build MySQL from source yourself, and set it as an option to `configure`.

If you install from something other than a packaging/installation system (such as .rpm, .dep, .exe, or .msi) make sure the MySQL server is started when the machine boots.

### Web Server

Installed Version Test: view the default welcome page at http://<your-machine>/

You have freedom of choice here, pretty much any web server that is capable of running CGI scripts will work. However, we strongly recommend using the Apache web server (either 1.3.x or 2.x), and the installation instructions usually assume you are using it. If you have got Bugzilla working using another webserver, please share your experiences with us by filing a bug in &bzg-bugs;.

If you don't have Apache and your OS doesn't provide official packages, visit .

### Bugzilla

Download a Bugzilla tarball (or check it out from CVS) and place it in a suitable directory, writable by the default web server user (probably nobody). Good locations are either directly in the main web space for your web server or perhaps in `/usr/local` with a symbolic link from the web space.

The default Bugzilla distribution is not designed to be placed in a `cgi-bin` directory. This includes any directory which is configured using the `ScriptAlias` directive of Apache.

Once all the files are in a web accessible directory, make that directory writable by your webserver's user. This is a temporary step until you run the `checksetup.pl` script, which locks down your installation.

### Perl Modules

Bugzilla's installation process is based on a script called `checksetup.pl`. The first thing it checks is whether you have appropriate versions of all the required Perl modules. The aim of this section is to pass this check. When it passes, do not run it again, but proceed to .

At this point, you need to `su` to root. You should remain as root until the end of the install. Then run:

    bash# ./checksetup.pl

`checksetup.pl` will print out a list of the required and optional Perl modules, together with the versions (if any) installed on your machine. The list of required modules is reasonably long; however, you may already have several of them installed.

There is a meta-module called Bundle::Bugzilla, which installs all the other modules with a single command. You should use this if you are running Perl 5.6.1 or above.

The preferred way of installing Perl modules is via CPAN on Unix, or PPM on Windows (see ). These instructions assume you are using CPAN; if for some reason you need to install the Perl modules manually, see .

    bash# perl -MCPAN -e 'install "<modulename>"'

If you using Bundle::Bugzilla, invoke the magic CPAN command on it. Otherwise, you need to work down the list of modules that `checksetup.pl` says are required, in the order given, invoking the command on each.

Many people complain that Perl modules will not install for them. Most times, the error messages complain that they are missing a file in @INC. Virtually every time, this error is due to permissions being set too restrictively for you to compile Perl modules or not having the necessary Perl development libraries installed on your system. Consult your local UNIX systems administrator for help solving these permissions issues; if you are the local UNIX sysadmin, please consult the newsgroup/mailing list for further assistance or hire someone to help you out.

Here is a complete list of modules and their minimum versions. Some modules have special installation notes, which follow.

Required Perl modules:

1. AppConfig (&min-appconfig-ver;)

2. CGI (&min-cgi-ver;)

3. Data::Dumper (&min-data-dumper-ver;)

4. Date::Format (&min-date-format-ver;)

5. DBI (&min-dbi-ver;)

6. DBD::mysql (&min-dbd-mysql-ver;)

7. File::Spec (&min-file-spec-ver;)

8. File::Temp (&min-file-temp-ver;)

9. Template (&min-template-ver;)

10. Text::Wrap (&min-text-wrap-ver;)

Optional Perl modules:

1. GD (&min-gd-ver;) for bug charting

2. Chart::Base (&min-chart-base-ver;) for bug charting

3. GD::Graph (&min-gd-graph-ver;) for bug charting

4. GD::Text::Align (&min-gd-text-align-ver;) for bug charting

5. XML::Parser (&min-xml-parser-ver;) for the XML interface

6. PatchReader (&min-patchreader-ver;) for pretty HTML view of patches

7. MIME::Parser (&min-mime-parser-ver;) for the optional email interface

#### DBD::mysql

The installation process will ask you a few questions about the desired compilation target and your MySQL installation. For most of the questions the provided default will be adequate, but when asked if your desired target is the MySQL or mSQL packages, you should select the MySQL-related ones. Later you will be asked if you wish to provide backwards compatibility with the older MySQL packages; you should answer YES to this question. The default is NO.

A host of 'localhost' should be fine. A testing user of 'test', with a null password, should have sufficient access to run tests on the 'test' database which MySQL creates upon installation.

#### Template Toolkit (&min-template-ver;)

When you install Template Toolkit, you'll get asked various questions about features to enable. The defaults are fine, except that it is recommended you use the high speed XS Stash of the Template Toolkit, in order to achieve best performance.

#### GD (&min-gd-ver;)

The GD module is only required if you want graphical reports.

The Perl GD module requires some other libraries that may or may not be installed on your system, including `libpng` and `libgd`. The full requirements are listed in the Perl GD module README. If compiling GD fails, it's probably because you're missing a required library.

The version of the GD module you need is very closely tied to the `libgd` version installed on your system. If you have a version 1.x of `libgd` the 2.x versions of the GD module won't work for you.

#### Chart::Base (&min-chart-base-ver;)

The Chart::Base module is only required if you want graphical reports. Note that earlier versions that 0.99c used GIFs, which are no longer supported by the latest versions of GD.

#### GD::Graph (&min-gd-graph-ver;)

The GD::Graph module is only required if you want graphical reports.

#### GD::Text::Align (&min-gd-text-align-ver;)

The GD::Text::Align module is only required if you want graphical reports.

#### XML::Parser (&min-xml-parser-ver;)

The XML::Parser module is only required if you want to import XML bugs using the `importxml.pl` script. This is required to use Bugzilla's "move bugs" feature; you may also want to use it for migrating from another bug database. XML::Parser requires that the `expat` library is already installed on your machine.

#### MIME::Parser (&min-mime-parser-ver;)

The MIME::Parser module is only required if you want to use the email interface located in the `contrib` directory.

#### PatchReader (&min-patchreader-ver;)

The PatchReader module is only required if you want to use Patch Viewer, a Bugzilla feature to show code patches in your web browser in a more readable form.

## Configuration

Poorly-configured MySQL and Bugzilla installations have given attackers full access to systems in the past. Please take the security parts of these guidelines seriously, even for Bugzilla machines hidden away behind your firewall.

### localconfig

Once you run `checksetup.pl` with all the correct modules installed, it displays a message about, and write out a file called, `localconfig`. This file contains the default settings for a number of Bugzilla parameters.

Load this file in your editor. The only value you need to change is $db_pass, the password for the user you will create for your database. Pick a strong password (for simplicity, it should not contain single quote characters) and put it here.

The other options in the `localconfig` file are documented by their accompanying comments. If you have a slightly non-standard MySQL setup, you may wish to change one or more of the other "$db_*" parameters.

You may also wish to change the names of the priorities, severities, operating systems and platforms for your installation. However, you can always change these after installation has finished; if you then re-run `checksetup.pl`, the changes will get picked up.

### MySQL

#### Security

MySQL ships as insecure by default. It allows anybody to on the local machine full administrative capabilities without requiring a password; the special MySQL root account (note: this is not the same as the system root) also has no password. Also, many installations default to running mysqld as the system root.

1. To disable the anonymous user account and set a password for the root user, execute the following. The root user password should be different to the bugs user password you set in `localconfig` in the previous section, and also different to the password for the system root account on your machine.

         bash$ mysql mysql
         mysql> DELETE FROM user WHERE user = '';
         mysql> UPDATE user SET password = password('new_password') WHERE user = 'root';
         mysql> FLUSH PRIVILEGES;

   From this point forward, to run the `mysql` command-line client, you will need to type `mysql -u root -p` and enter new_password when prompted.

2. If you run MySQL on the same machine as your web server, you should disable remote access to MySQL by adding the following to your `/etc/my.conf`:

         [myslqd]
         # Prevent network access to MySQL.
         skip-networking

3. Consult the documentation that came with your system for information on making mysqld run as an unprivileged user.

4. For added security, you could also run MySQL, or even all of Bugzilla in a chroot jail; however, instructions for doing that are beyond the scope of this document.

#### Allow large attachments

You need to configure MySQL to accept large packets, if you want to have attachments larger than 64K. Add the text below to your `/etc/my.conf`. There is also a parameter in Bugzilla for setting the maximum allowable attachment size, (default 1MB). Bugzilla will only accept attachments up to the lower of these two sizes.

      [mysqld]
      # Allow packets up to 1M
      set-variable = max_allowed_packet=1M

#### Add a user to MySQL

You need to add a new MySQL user for Bugzilla to use. (It's not safe to have Bugzilla use the MySQL root account.) The following instructions assume the defaults in `localconfig`; if you changed those, you need to modify the SQL command appropriately. You will need the $db_pass password you set in `localconfig` in .

We use an SQL `GRANT` command to create a bugs user. This also restricts the bugs user to operations within a database called bugs, and only allows the account to connect from localhost. Modify it to reflect your setup if you will be connecting from another machine or as a different user.

Run the `mysql` command-line client and enter:

      mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,
             DROP,REFERENCES ON bugs.* TO bugs@localhost
             IDENTIFIED BY '$db_pass';
      mysql> FLUSH PRIVILEGES;

If you are using MySQL 4, you need to add the `LOCK TABLES` and `CREATE TEMPORARY TABLES` permissions to the list.

### checksetup.pl

Next, rerun `checksetup.pl`. It reconfirms that all the modules are present, and notices the altered localconfig file, which it assumes you have edited to your satisfaction. It compiles the UI templates, connects to the database using the 'bugs' user you created and the password you defined, and creates the 'bugs' database and the tables therein.

After that, it asks for details of an administrator account. Bugzilla can have multiple administrators - you can create more later - but it needs one to start off with. Enter the email address of an administrator, his or her full name, and a suitable Bugzilla password.

`checksetup.pl` will then finish. You may rerun `checksetup.pl` at any time if you wish.

### Web server

Configure your web server according to the instructions in the appropriate section. The Bugzilla Team recommends Apache.

#### Apache httpd

Load `httpd.conf` in your editor.

Uncomment (or add) the following line. This configures Apache to run .cgi files outside the `cgi-bin` directory.

      AddHandler cgi-script .cgi

Apache uses `<Directory>` directives to permit fine-grained permission setting. Add the following two lines to a `<Directory>` directive that applies either to the Bugzilla directory or one of its parents (e.g. the `<Directory /var/www/html>` directive). This allows Bugzilla's `.htaccess` files to override global permissions, and allows .cgi files to run in the Bugzilla directory.

      Options +ExecCGI +FollowSymLinks
      AllowOverride Limit

Add `index.cgi` to the end of the `DirectoryIndex` line.

`checksetup.pl` can set tighter permissions on Bugzilla's files and directories if it knows what user the webserver runs as. Look for the `User` line in `httpd.conf`, and place that value in the $webservergroup variable in `localconfig`. Then rerun `checksetup.pl`.

#### Microsoft Internet Information Services

If you need, or for some reason even want, to use Microsoft's Internet Information Services or Personal Web Server you should be able to. You will need to configure them to know how to run CGI scripts. This is described in Microsoft Knowledge Base article Q245225 for Internet Information Services and Q231998 for Personal Web Server.

Also, and this can't be stressed enough, make sure that files such as `localconfig` and your `data` directory are secured as described in .

#### AOL Server

Ben FrantzDale reported success using AOL Server with Bugzilla. He reported his experience and what appears below is based on that.

AOL Server will have to be configured to run CGI scripts, please consult the documentation that came with your server for more information on how to do this.

Because AOL Server doesn't support `.htaccess` files, you'll have to create a TCL script. You should create an `aolserver/modules/tcl/filter.tcl` file (the filename shouldn't matter) with the following contents (change `/bugzilla/` to the web-based path to your Bugzilla installation):

      ns_register_filter preauth GET /bugzilla/localconfig filter_deny
      ns_register_filter preauth GET /bugzilla/localconfig~ filter_deny
      ns_register_filter preauth GET /bugzilla/\#localconfig\# filter_deny
      ns_register_filter preauth GET /bugzilla/*.pl filter_deny
      ns_register_filter preauth GET /bugzilla/syncshadowdb filter_deny
      ns_register_filter preauth GET /bugzilla/runtests.sh filter_deny
      ns_register_filter preauth GET /bugzilla/data/* filter_deny
      ns_register_filter preauth GET /bugzilla/template/* filter_deny

      proc filter_deny { why } {
          ns_log Notice "filter_deny"
          return "filter_return"
      }

This probably doesn't account for all possible editor backup files so you may wish to add some additional variations of `localconfig`. For more information, see bug 186383 or Bugtraq ID 6501.

If you are using webdot from research.att.com (the default configuration for the `webdotbase` paramater), you will need to allow access to `data/webdot/*.dot` for the reasearch.att.com machine.

If you are using a local installation of GraphViz, you will need to allow everybody to access `*.png`, `*.gif`, `*.jpg`, and `*.map` in the `data/webdot` directory.

#### Web Server Access Controls

Users of Apache can skip this section because Bugzilla ships with `.htaccess` files which restrict access in the manner required. Users of other webservers, read on.

There are several files in the Bugzilla directory that should not be accessible from the web. You need to configure your webserver so they they aren't. Not doing this may reveal sensitive information such as database passwords.

- In the main Bugzilla directory, you should:

  - Block:

    - `*.pl`
    - `*localconfig*`
    - `runtests.sh`

  - But allow:

    - `localconfig.js`
    - `localconfig.rdf`

- In `data`:

  - Block everything

  - But allow:

    - `duplicates.rdf`

- In `data/webdot`:

  - If you use a remote webdot server:

    - Block everything

    - But allow

      - `*.dot`
      only for the remote webdot server

  - Otherwise, if you use a local GraphViz:

    - Block everything

    - But allow:

      - `*.png`
      - `*.gif`
      - `*.jpg`
      - `*.map`

  - And if you don't use any dot:

    - Block everything

- In `Bugzilla`:

  - Block everything

- In `template`:

  - Block everything

You should test to make sure that the files mentioned above are not accessible from the Internet, especially your `localconfig` file which contains your database password. To test, simply point your web browser at the file; for example, to test mozilla.org's installation, we'd try to access . You should get a 403 Forbidden error.

### Bugzilla

Your Bugzilla should now be working. Access `http://<your-bugzilla-server>/` - you should see the Bugzilla front page. If not, consult the Troubleshooting section, .

Log in with the administrator account you defined in the last `checksetup.pl` run. You should go through the parameters on the Edit Parameters page (see link in the footer) and see if there are any you wish to change. They key parameters are documented in ; you should certainly alter `maintainer` and `urlbase`; you may also want to alter `cookiepath` or `requirelogin`.

This would also be a good time to revisit the `localconfig` file and make sure that the names of the priorities, severities, platforms and operating systems are those you wish to use when you start creating bugs. Remember to rerun `checksetup.pl` if you change it.

Bugzilla has several optional features which require extra configuration. You can read about those in .

## Optional Additional Configuration

Bugzilla has a number of optional features. This section describes how to configure or enable them.

### Bug Graphs

If you have installed the necessary Perl modules you can start collecting statistics for the nifty Bugzilla graphs.

    bash# crontab -e

This should bring up the crontab file in your editor. Add a cron entry like this to run `collectstats.pl` daily at 5 after midnight:

    5 0 * * * cd <your-bugzilla-directory> ; ./collectstats.pl

After two days have passed you'll be able to view bug graphs from the Reports page.

### Dependency Charts

As well as the text-based dependency trees, Bugzilla also supports a graphical view of dependency relationships, using a package called 'dot'. Exactly how this works is controlled by the 'webdotbase' parameter, which can have one of three values:

1. A complete file path to the command 'dot' (part of GraphViz) will generate the graphs locally

2. A URL prefix pointing to an installation of the webdot package will generate the graphs remotely

3. A blank value will disable dependency graphing.

The easiest way to get this working is to install GraphViz. If you do that, you need to enable server-side image maps in Apache. Alternatively, you could set up a webdot server, or use the AT&T public webdot server. This is the default for the webdotbase param, but it's often overloaded and slow. Note that AT&T's server won't work if Bugzilla is only accessible using HARTS. Editor's note: What the heck is HARTS? Google doesn't know...

### The Whining Cron

What good are bugs if they're not annoying? To help make them more so you can set up Bugzilla's automatic whining system to complain at engineers which leave their bugs in the NEW or REOPENED state without triaging them.

This can be done by adding the following command as a daily crontab entry, in the same manner as explained above for bug graphs. This example runs it at 12.55am.

    55 0 * * * cd <your-bugzilla-directory> ; ./whineatnews.pl

### Patch Viewer

Patch Viewer is the engine behind Bugzilla's graphical display of code patches. You can integrate this with copies of the `cvs`, `lxr` and `bonsai` tools if you have them, by giving the locations of your installation of these tools in `editparams.cgi`.

Patch Viewer also optionally will use the `cvs`, `diff` and `interdiff` command-line utilities if they exist on the system. Interdiff can be obtained from . If these programs are not in the system path, you can configure their locations in `localconfig`.

### LDAP Authentication

LDAP authentication is a module for Bugzilla's plugin authentication architecture.

The existing authentication scheme for Bugzilla uses email addresses as the primary user ID, and a password to authenticate that user. All places within Bugzilla where you need to deal with user ID (e.g assigning a bug) use the email address. The LDAP authentication builds on top of this scheme, rather than replacing it. The initial log in is done with a username and password for the LDAP directory. This then fetches the email address from LDAP and authenticates seamlessly in the standard Bugzilla authentication scheme using this email address. If an account for this address already exists in your Bugzilla system, it will log in to that account. If no account for that email address exists, one is created at the time of login. (In this case, Bugzilla will attempt to use the "displayName" or "cn" attribute to determine the user's full name.) After authentication, all other user-related tasks are still handled by email address, not LDAP username. You still assign bugs by email address, query on users by email address, etc.

Because the Bugzilla account is not created until the first time a user logs in, a user who has not yet logged is unknown to Bugzilla. This means they cannot be used as an assignee or QA contact (default or otherwise), added to any cc list, or any other such operation. One possible workaround is the `bugzilla_ldapsync.rb` script in the `contrib` directory. Another possible solution is fixing bug 201069.

Parameters required to use LDAP Authentication:

loginmethod

  This parameter should be set to LDAP only if you will be using an LDAP directory for authentication. If you set this param to LDAP but fail to set up the other parameters listed below you will not be able to log back in to Bugzilla one you log out. If this happens to you, you will need to manually edit `data/params` and set loginmethod to DB.

LDAPserver

  This parameter should be set to the name (and optionally the port) of your LDAP server. If no port is specified, it assumes the default LDAP port of 389.

  Ex. ldap.company.com or ldap.company.com:3268

LDAPbinddn [Optional]

  Some LDAP servers will not allow an anonymous bind to search the directory. If this is the case with your configuration you should set the LDAPbinddn parameter to the user account Bugzilla should use instead of the anonymous bind.

  Ex. cn=default,cn=user:password

LDAPBaseDN

  The LDAPBaseDN parameter should be set to the location in your LDAP tree that you would like to search for email addresses. Your uids should be unique under the DN specified here.

  Ex. ou=People,o=Company

LDAPuidattribute

  The LDAPuidattribute parameter should be set to the attribute which contains the unique UID of your users. The value retrieved from this attribute will be used when attempting to bind as the user to confirm their password.

  Ex. uid

LDAPmailattribute

  The LDAPmailattribute parameter should be the name of the attribute which contains the email address your users will enter into the Bugzilla login boxes.

  Ex. mail

### Prevent users injecting malicious Javascript

It is possible for a Bugzilla user to take advantage of character set encoding ambiguities to inject HTML into Bugzilla comments. This could include malicious scripts. Due to internationalization concerns, we are unable to incorporate by default the code changes suggested by the CERT advisory on this issue. If your installation is for an English speaking audience only, making the change below will prevent this problem.

Simply locate the following line in `Bugzilla/CGI.pm`:

    $self->charset('');

and change it to:

    $self->charset('ISO-8859-1');

### `mod_throttle`

It is possible for a user, by mistake or on purpose, to access the database many times in a row which can result in very slow access speeds for other users. If your Bugzilla installation is experiencing this problem, you may install the Apache module `mod_throttle` which can limit connections by IP address. You may download this module at . Follow the instructions to install into your Apache install. This module only functions with the Apache web server! The command you need is `ThrottleClientIP`. See the documentation for more information.

### TCP/IP Ports

A single-box Bugzilla only requires port 80, plus port 25 if you are using the optional email interface. You should firewall all other ports and/or disable services listening on them.

### Daemon Accounts

Many daemons, such as Apache's httpd and MySQL's mysqld default to running as either root or nobody. Running as root introduces obvious security problems, but the problems introduced by running everything as nobody may not be so obvious. Basically, if you're running every daemon as nobody and one of them gets compromised, they all get compromised. For this reason it is recommended that you create a user account for each daemon.

## OS-Specific Installation Notes

Many aspects of the Bugzilla installation can be affected by the the operating system you choose to install it on. Sometimes it can be made easier and others more difficult. This section will attempt to help you understand both the difficulties of running on specific operating systems and the utilities available to make it easier.

If you have anything to add or notes for an operating system not covered, please file a bug in &bzg-bugs;.

### Microsoft Windows

Making Bugzilla work on Windows is still a painful processes. The Bugzilla Team is working to make it easier, but that goal is not considered a top priority. If you wish to run Bugzilla, we still recommend doing so on a Unix based system such as GNU/Linux. As of this writing, all members of the Bugzilla team and all known large installations run on Unix based systems.

If after hearing all that, you have enough pain tolerance to attempt installing Bugzilla on Win32, here are some pointers.

#### Win32 Perl

Perl for Windows can be obtained from ActiveState. You should be able to find a compiled binary at .

#### Perl Modules on Win32

Bugzilla on Windows requires the same perl modules found in . The main difference is that windows uses PPM instead of CPAN.

    C:\perl> ppm install <module name>

The above syntax should work for all modules with the exception of Template Toolkit. The Template Toolkit website suggests using the instructions on OpenInteract's website.

The following commands will install the required packages missing from the ActivePerl default installation:

    ppm repository add oi http://openinteract.sourceforge.net/ppmpackages
    ppm install DBD-mysql
    ppm install Template-Toolkit
    ppm install TimeDate

#### Code changes required to run on win32

As Bugzilla still doesn't run "out of the box" on Windows, code has to be modified. This section lists the required changes.

##### Changes to `checksetup.pl`

In `checksetup.pl`, the line reading:

    my $mysql_binaries = `which mysql`;

to

    my $mysql_binaries = "D:\\mysql\\bin\\mysql";

And you'll also need to change:

    my $webservergid = getgrnam($my_webservergroup)

to

    my $webservergid = '8'

##### Changes to `BugMail.pm`

To make bug email work on Win32 (until bug 84876 lands), the simplest way is to have the Net::SMTP Perl module installed and change this:

    open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
      die "Can't open sendmail";

    print SENDMAIL trim($msg) . "\n";
    close SENDMAIL;

to

    use Net::SMTP;
    my $smtp_server = 'smtp.mycompany.com';  # change this

    # Use die on error, so that the mail will be in the 'unsent mails' and
    # can be sent from the sanity check page.
    my $smtp = Net::SMTP->new($smtp_server) ||
      die 'Cannot connect to server \'$smtp_server\'';

    $smtp->mail('bugzilla-daemon@mycompany.com');  # change this
    $smtp->to($person);
    $smtp->data();
    $smtp->datasend($msg);
    $smtp->dataend();
    $smtp->quit;

Don't forget to change the name of your SMTP server and the domain of the sending email address (after the '@') in the above lines of code.

#### Serving the web pages

As is the case on Unix based systems, any web server should be able to handle Bugzilla; however, the Bugzilla Team still recommends Apache whenever asked. No matter what web server you choose, be sure to pay attention to the security notes in . More information on configuring specific web servers can be found in .

If using Apache on windows, you can set the ScriptInterpreterSource directive in your Apache config to avoid having to modify the first line of every script to contain your path to perl instead of `/usr/bin/perl`.

### Mac OS X

Apple did not include the GD library with Mac OS X. Bugzilla needs this for bug graphs.

You can install it using a program called Fink, which is similar in nature to the CPAN installer, but installs common GNU utilities. Fink is available from .

Follow the instructions for setting up Fink. Once it's installed, you'll want to use it to install the `gd2` package.

It will prompt you for a number of dependencies, type 'y' and hit enter to install all of the dependencies and then watch it work. You will then be able to use CPAN to install the GD Perl module.

To prevent creating conflicts with the software that Apple installs by default, Fink creates its own directory tree at `/sw` where it installs most of the software that it installs. This means your libraries and headers will be at `/sw/lib` and `/sw/include` instead of `/usr/lib` and `/usr/include`. When the Perl module config script asks where your `libgd` is, be sure to tell it `/sw/lib`.

Also available via Fink is `expat`. After using fink to install the expat package you will be able to install XML::Parser using CPAN. There is one caveat. Unlike recent versions of the GD module, XML::Parser doesn't prompt for the location of the required libraries. When using CPAN, you will need to use the following command sequence:

    # perl -MCPAN -e'look XML::Parser'
    # perl Makefile.PL EXPATLIBPATH=/sw/lib EXPATINCPATH=/sw/include
    # make; make test; make install
    # exit

The look command will download the module and spawn a new shell with the extracted files as the current working directory. The exit command will return you to your original shell.

You should watch the output from these make commands, especially make test as errors may prevent XML::Parser from functioning correctly with Bugzilla.

### Linux-Mandrake 8.0

Linux-Mandrake 8.0 includes every required and optional library for Bugzilla. The easiest way to install them is by using the `urpmi` utility. If you follow these commands, you should have everything you need for Bugzilla, and `./checksetup.pl` should not complain about any missing libraries. You may already have some of these installed.

    bash# urpmi perl-mysql
    bash# urpmi perl-chart
    bash# urpmi perl-gd
    bash# urpmi perl-MailTools
    bash# urpmi apache-modules

for Bugzilla email integration

## Troubleshooting

This section gives solutions to common Bugzilla installation problems. If none of the section headings seems to match your problem, read the general advice.

### General Advice

If you can't get `checksetup.pl` to run to completion, it normally explains what's wrong and how to fix it. If you can't work it out, or if it's being uncommunicative, post the errors in the netscape.public.mozilla.webtools newsgroup.

If you have made it all the way through (Installation) and (Configuration) but accessing the Bugzilla URL doesn't work, the first thing to do is to check your webserver error log. For Apache, this is often located at `/etc/logs/httpd/error_log`. The error messages you see may be self-explanatory enough to enable you to diagnose and fix the problem. If not, see below for some commonly-encountered errors. If that doesn't help, post the errors to the newsgroup.

### I installed a Perl module, but `checksetup.pl` claims it's not installed!

You have two versions of Perl on your machine. You are installing modules into one, and Bugzilla is using the other. Rerun the CPAN commands (or manual compile) using the full path to Perl from the top of `checksetup.pl`. This will make sure you are installing the modules in the right place.

### Bundle::Bugzilla makes me upgrade to Perl 5.6.1

Try executing `perl -MCPAN -e 'install CPAN'` and then continuing.

Certain older versions of the CPAN toolset were somewhat naive about how to upgrade Perl modules. When a couple of modules got rolled into the core Perl distribution for 5.6.1, CPAN thought that the best way to get those modules up to date was to haul down the Perl distribution itself and build it. Needless to say, this has caused headaches for just about everybody. Upgrading to a newer version of CPAN with the commandline above should fix things.

### DBD::Sponge::db prepare failed

The following error message may appear due to a bug in DBD::mysql (over which the Bugzilla team have no control):

     DBD::Sponge::db prepare failed: Cannot determine NUM_OF_FIELDS at D:/Perl/site/lib/DBD/mysql.pm line 248.
      SV = NULL(0x0) at 0x20fc444
      REFCNT = 1
      FLAGS = (PADBUSY,PADMY)

To fix this, go to `<path-to-perl>/lib/DBD/sponge.pm` in your Perl installation and replace

     my $numFields;
     if ($attribs->{'NUM_OF_FIELDS'}) {
         $numFields = $attribs->{'NUM_OF_FIELDS'};
     } elsif ($attribs->{'NAME'}) {
         $numFields = @{$attribs->{NAME}};

by

     my $numFields;
     if ($attribs->{'NUM_OF_FIELDS'}) {
         $numFields = $attribs->{'NUM_OF_FIELDS'};
     } elsif ($attribs->{'NAMES'}) {
         $numFields = @{$attribs->{NAMES}};

(note the S added to NAME.)

### cannot chdir(/var/spool/mqueue)

If you are installing Bugzilla on SuSE Linux, or some other distributions with paranoid security options, it is possible that the checksetup.pl script may fail with the error:

    cannot chdir(/var/spool/mqueue): Permission denied

This is because your `/var/spool/mqueue` directory has a mode of drwx------. Type `chmod 755 `/var/spool/mqueue`` as root to fix this problem.

### Your vendor has not defined Fcntl macro O_NOINHERIT

This is caused by a bug in the version of File::Temp that is distributed with perl 5.6.0. Many minor variations of this error have been reported:

    Your vendor has not defined Fcntl macro O_NOINHERIT, used
    at /usr/lib/perl5/site_perl/5.6.0/File/Temp.pm line 208.

    Your vendor has not defined Fcntl macro O_EXLOCK, used
    at /usr/lib/perl5/site_perl/5.6.0/File/Temp.pm line 210.

    Your vendor has not defined Fcntl macro O_TEMPORARY, used
    at /usr/lib/perl5/site_perl/5.6.0/File/Temp.pm line 233.

Numerous people have reported that upgrading to version 5.6.1 or higher solved the problem for them. A less involved fix is to apply the following patch, which is also available as a patch file.

    --- File/Temp.pm.orig   Thu Feb  6 16:26:00 2003
    +++ File/Temp.pm        Thu Feb  6 16:26:23 2003
    @@ -205,6 +205,7 @@
         # eg CGI::Carp
         local $SIG{__DIE__} = sub {};
         local $SIG{__WARN__} = sub {};
    +    local *CORE::GLOBAL::die = sub {};
         $bit = &$func();
         1;
       };
    @@ -226,6 +227,7 @@
         # eg CGI::Carp
         local $SIG{__DIE__} = sub {};
         local $SIG{__WARN__} = sub {};
    +    local *CORE::GLOBAL::die = sub {};
         $bit = &$func();
         1;
       };