Gallery3:Installation on Windows Server 2008 and IIS7 - Gallery Codex
Personal tools

Gallery3:Installation on Windows Server 2008 and IIS7

From Gallery Codex

Running Gallery 3 on Windows environment is not officially supported by the Gallery Team.

Windows Server 2008 and Apache: Gallery3:Installation_on_Windows_and_Apache

If you need help, feel free to contact me: Ranger187@Gmail.com

Note:As of version 3.0.4 Windows install is commented out, you need to edit the index.php


I have created a windows GitHUB area forked off the current code.


Requirements

  1. Windows Server 2008 / 2008 R2
  2. FastCGI Verify this is done
  3. MySQL 5.x
  4. Mod_Rewrite
  5. PHP 5.3 Non-Thread Safe
  6. Edit index.php to install on Windows
  7. Installing and Upgrading Gallery DO THIS LAST

Download

MySQL:

  • Download MySQL Installer:
MySQL Download

MOD_REWRITE:

  • Download Mod_Rewrite using Microsoft's Web Installer:
Via Microsoft Installer or via ModRewrite Installer


WINCACHE (Not needed but it increases php transaction speed):

  • Download WinCache using Microsoft's Web Installer:
Via Microsoft Installer or via WinCache Installer

PHP:

  • Download PHP and REBOOT after installing:
Via Microsoft Installer or via PHP Installer

Edit index.php to allow Windows install

  • Find and delete:

// Gallery is not supported on Windows. if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { exit("Gallery is not supported on Windows (PHP reports that you're using: " . PHP_OS . ")"); }

Installing MySQL

The default Setting of the MySQL Installer are mostly good, but there are some important things:

  • Make sure you set a root password!
  • Choose "Transactional" database during install

Setting up the Database

In this guide we use "gallery3" as the database name for your gallery, you can choose another if you want.

There are 2 ways to setup the database. I will explain both. The first example is overkill.

EXAMPLE 1

  • Start the MySQL Command Line Client
Start Menu -> MySQL -> MySQL Server 5.1 -> MySQL Command Line Client
  • Enter your root password (defined during install of MySQL) and press "Enter"
  • Create a database for your gallery. Enter the following statement and press "Enter".
CREATE DATABASE gallery3;
  • Create a user for accessing the database. Replace "yourPasswordHere" with a password of your choice. Enter the following statement and press "Enter".
GRANT USAGE ON * . * TO 'gallery3'@'localhost' IDENTIFIED BY 'yourPasswordHere';
  • Grant the created user rights on your new database. Enter the following statement and press "Enter".
GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , ALTER ON `gallery3` . * TO 'gallery3'@'localhost';
  • Leave the MySQL Command Line Client. Enter the following statement and press "Enter".
exit

EXAMPLE 2

  • Goto your database location (It is defined in the my.ini) #Path to the database root
EXAMPLE: datadir="C:/Program Files/MySQL/MySQL Server 5.x/Data/"
Make a new folder called "gallery3" in that Data directory. DONE!


Installing PHP

  • Be sure to include extensions option when installing
  • PHP's safe_mode must be disabled.
  • PHP must have mbstring, mysqli, gettext, gd extensions installed.
 Edit Php.ini and make sure in extensions it has the following lines un-commented or added:
 extension=php_mbstring.dll  
 extension=php_mysqli.dll
 extension=php_gettext.dll
 extension=php_gd2.dll 
* short_open_tag must be On.
 Edit Php.ini and make sure it says: short_open_tag = On

PHP Memory Limit: 32M should be the minimum for PHP's memory limit if you're restricted to using GD as your image toolkit. Processing images with GD eats into PHP's allotted memory and can get consumed rather quickly with even smaller images.

Configure PHP Extensions (Not Needed just a FYI)

  • Open C:\PHP\PHP.INI

Example: Enabling GD2 extension

Find the extension in your php.ini and remove the ; in front of the line ;extension=php_gd2.dll

  • Find
;extension=php_gd2.dll 
  • Replace it with
extension=php_gd2.dll

Testing PHP Installation

  • Open IIS and on the left expand it to "Sites"
  • In the left pane, right-click on the website you are working with and select Manage Web Site > Browse
  • Create a new file called test.php in that location
  • The contents of test.php should be:
<?php phpinfo(); ?>


Open the test.php file via your browser, example: http://www.example.com/test.php

A page showing your PHP configuration settings should now appear.

Another way to test php is via the CMD line

  • Open the CMD prompt (Start > Run > "CMD")
  • We are assuming your website is in C:\Inetpub\wwwroot (If it's not, navigate to the correct directory) and that you already have an index.php or test.php file.
  • Navigate to your website directory, example: Type: "cd\" , then "cd inetpub" then "cd wwwroot"
  • Type: "php index.php" or "php test.php"
  • It should yield a bunch of info on the screen, if so type "exit"


After you have verified your PHP install, delete the test.php file from your website.


ImageMagick (Should not be used on an owned server, only CO-HOSTED, it's too slow)

NOTE: The 6.4.2 windows binaries do not seem to play well with G2. After much testing, I finally installed the 6.4.1 binaries that i had working on my WinXP box, and that made IM work. See forum post: http://galleryproject.org/node/79750 for more info and the binary I used. -Jrevillini 15:02, 18 July 2008 (UTC)

  • Download ImageMagick-6.2.3-0-Q16-windows-static.exe from http://imagemagick.org/script/binary-releases.php#windows, or the version Jrevillini found in his forum post linked above.
  • Install to C:\IM (or another location to your liking, but it's best kept in a folder structure without spaces in it)
  • Give IIS_IUSR account read/execute permissions on the folder where you just installed the ImageMagick binaries.
  • Give IIS_IUSR account read/execute permissions to cmd.exe (see bottom of article for more info on using cacls to do this)
  • Input correct path in "admin->settings->advanced -> gallery graphics_toolkit_path" to get ImageMagic and GraphicsMagick to work. Updated 2012-09-17

NOTE: I had trouble successfully configuring the Image Magick plugin in Gallery unless the binaries were installed in a folder higher than the location set in open_basedir. Until I tried that all of the plugin path tests would fail. --Scn095 06:12, 1 January 2009 (UTC)

NOTE: This forum post might be helpfull in your setup for getting IM to work: http://galleryproject.org/node/102233#comment-375859

Ffmpeg

  • Download the latest SVN snapshot from celtic-druid. It is packaged in 7z format; so you will probably need 7-Zip File manager to unzip it. For convenience, you can download a zip version (rev9133) from geesu.
  • Specify the executable in Ffmpeg module configuration.

Dcraw

  • Download dcraw.exe from here or choose processor-optimized version from Benjamin Lebsanft website
  • Specify the executable in Dcraw module configuration.


Permissions for Gallery3 Data Directory

Give IIS_IUSR Modify permission on the var directory.

  • Right click the var directory, select PROPERTIES , SECURITY , EDIT , ADD , ADVANCED , FIND NOW , IIS_IUSR

Change log

This area is to describe any changes made from the standard(default) version available.

  1. [FILE EDIT] Removed the 3 lines prohibiting windows install in index.php
  2. [MODULES] Added Modules/Win_Platform in the base file. See Gallery3:Modules:win_platform for how to install.

Troubleshooting

Checking for bad image files in windows

BadPeggy Download via dropbox


Admin Dashboard Platform Information Block Issue

My patch proposal for \modules\gallery\views\admin_block_platform.html.php:
Line 18 + <?php if (function_exists("sys_getloadavg")): ?>
Line 21 + <?php endif; ?>

ImageMagick

ImageMagick not found - follow the instructions @ https://sourceforge.net/apps/trac/gallery/ticket/308#comment:6

Install on Mac OSX

MacOSX Gallery3:Installation_on_MacOS_X