B. Configuring Gallery

B.1. The setup page tells me that mod_rewrite is not installed. Since mod_rewrite is optional, how do I configure this option?
B.2. Does Gallery work under Windows?
B.3. How do I run PHP as a CGI?
B.4. How do I force .php files to use PHP4?
B.5. Where can I find the unzip and zipinfo binaries?
B.1.

The setup page tells me that mod_rewrite is not installed. Since mod_rewrite is optional, how do I configure this option?

Mod_rewrite is a module that is compiled with Apache. To enable it, you must have root access to the server. Unless you compiled Apache by yourself, most distributions will include mod_rewrite, but not necessarily enabled it. The most common way to do so is this:

        LoadModule rewrite_module libexec/mod_rewrite.so
        AddModule mod_rewrite.c
       

For more information on mod_rewrite check out the Apache module mod_rewrite page.

B.2.

Does Gallery work under Windows?

Many people have gotten Gallery to work under Windows using Apache. However, Gallery does not interact well with IIS, because PHP still has some issues with executing programs like NetPBM and ImageMagick.

B.3.

How do I run PHP as a CGI?

Running PHP as a CGI is usually done when PHP is not available on your server (but you can execute cgi-bin scripts) or when the normal PHP installation is running in safe mode. Note that in order for this to work, your server must be configured to read .htaccess files, which your host can disable!

  1. Obtain a CGI version of PHP for your platform. You can downloads PHP binaries for various platforms on the Gallery SourceForge Download Page. If you can't find a binary for your platform, but you have access to compile programs, you can configure PHP with this configure line.

              ./configure --enable-force-cgi-redirect --disable-safe-mode
              --with-config-file-path=/usr/local/lib/php-cgi
             

    Then run make. The resulting binary will be called php in the sapi/cgi/ directory of the PHP source. Please submit the binary to Andrew Lindeman, so he can include it on the download page. Please only submit binaries that use that exact configure line, for consistancy reasons.

  2. Upload the CGI version of PHP to the cgi-bin directory and call it php.cgi. Upload it in BINARY FTP mode.

  3. Chmod php.cgi 755 (chmod 755 php.cgi)

  4. Create a new directory in your webserver root called php-cgi

  5. Create a new .htaccess file in your php-cgi directory and put the following lines in it:

              RemoveHandler .php
              AddType application/cgi-php php
              Action application/cgi-php /cgi-bin/php.cgi
             

That should be it! Install Gallery in your php-cgi directory. It is extremely difficult to provide support for this, because there are many things that can go wrong and it's hard to diagnose the problem.

B.4.

How do I force .php files to use PHP4?

In the rare case that your ISP has PHP3 and PHP4 installed on the same server, sometimes .php files will end up being parsed by the PHP3 parser, which Gallery can't run under. To force .php files to use the PHP4 parser, add these to your .htaccess file.

        <Files *.php>
         ForceType application/x-httpd-php
        </Files>
       

B.5.

Where can I find the unzip and zipinfo binaries?

You can download the latest unzip binary from the Info-Zip website .

The recent releases of unzip no longer come with a zipinfo binary. That's ok, though because it's really just the same binary as unzip with a different name. Just make a copy of unzip and call it zipinfo and then tell Gallery about that on page 2 of the config wizard and you'll be all set.