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.

This install WILL work provided you are running Windows Server 2008, have local admin and IIS 7/7.5 (co-hosted boxes are not supported)


Anything below Windows Server 2008 is NOT SUPPORTED.

Just a FYI you might be interested in: Gallery3:Installation_on_Windows_and_Apache


SIDE NOTE: If you use Microsoft's Web Platform Installer, technically, it will install all but mod_rewrite on XP/Vista/7 and this is NOT written for anything below IIS7/Windows 2008

If you need help on a NON-COHOSTED box, feel free to contact me: Ranger187@Gmail.com

Contents

Requirements

PHP: 5.2.3 and newer.

  • PHP's safe_mode must be disabled and (simplexml, filter, and json must be installed.) <-- Not need in 2008
 Edit Php.ini and make sure in extensions is has: extension=php_mbstring.dll
 Edit Php.ini and make sure it says: short_open_tag = On

Database: MySQL 5 and later

Browser: Flash is required for the simple file upload function (Add > Add Photos).

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.

You have to download the latest Versions of MySQL and PHP.

MySQL:

  • Download the latest "MySQL Essential installer (MSI) package" from:
http://dev.mysql.com/downloads/mysql/5.1.html

PHP:

  • Download the latest version of PHP from:
Microsoft's Web Installer: http://www.microsoft.com/web/downloads/platform.aspx or via http://php.iis.net/


MOD_REWRITE:

  • Download Mod_Rewrite using Microsoft's Web Installer:
Microsoft's Web Installer: http://www.microsoft.com/web/downloads/platform.aspx or via http://www.iis.net/download/URLRewrite

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

  • Download WinCache using Microsoft's Web Installer:
Microsoft's Web Installer: http://www.microsoft.com/web/downloads/platform.aspx or via http://www.iis.net/download/WinCacheForPHP

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!
  • On screen 8 of the installer choose "Transactional"

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 "galery3" in that Data directory. DONE!

Installing PHP

  • PHP is now auto installed and configured via Microsoft's Web Platform installer!
REMEMBER TO REBOOT AFTER INSTALLING PHP!


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://gallery.menalto.com/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 IUSR account read/execute permissions on the folder where you just installed the ImageMagick binaries.
  • Give IUSR account read/execute permissions to cmd.exe (see bottom of article for more info on using cacls to do this)

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://gallery.menalto.com/node/102233#comment-375859

NetPBM

jhead

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.

Zip/UnZip

  • Download the following files:
    • zip
    • unzip
    • Note: These files are the zip and unzip packages from cygwin, the appropriate dll must be included in the same directory for it to function
  • Extract the files to C:\zip
  • Give IUSR_machinename read/exec permissions on C:\zip

Permissions for Gallery3 Data Directory

Give IUSR Modify permission on the var directory.

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

Troubleshooting

FAQ

Why am I getting a CGI Application Error on my website or a "Error: HTTP POST failed (HTTP 502 Bad Gateway )" with gallery remote?

This can occur if you are uploading a file that takes over 300 seconds. Changing the max_execution_time variable in the php.ini above the default IIS value will not fix this problem. You need to change the CGITimeout property which is in the IIS metabase.

Some scripts are offered to help change this variable, but I prefer a GUI. Download this IIS Administration Pack and it will install metabase explorer.

Run the metabase explorer, then expand LM, and find W3SVC. Under this you will see a CGITimeout property, it should be set to 300 (that is the default). Increase this value so that your script can take longer to upload a file. Please realize though that ANY page hosted by IIS will have this timeout value, this is not set on a per site basis.


Why am I receiving a "Invalid access to memory location" error message?

Assuming you have installed PHP using the ISAPI dll. You now need to restart IIS. To do this, click start, then run, and type "iisreset /restart" then click ok. The problem *should* now be fixed.

REASON: You should NOT be using ISAPI on Windows Server 2008. FastCGI out performs ISAPI and this issue is ONLY present on mis-configured servers or co-hosted servers. AGAIN, do NOT use the ISAPI module.

Admin dashboard platform information block

Try: Gallery3:Modules:win_platform

Issues with short open tags

NOTE: This only happens on co-hosted servers.

Try: http://gallery.menalto.com/node/103784

TODO?

  • make sure permissions are set on gallery2 dir, after copying. Permissions are not inherited when files/directories are copied within the same volume.
  • add index.php as directory index in web site configuration
  • permissions gallery2/config.php
  • cmd.exe, give (IUSR) execute permissions (module activation), or run from command line [cacls %COMSPEC% /E /G %COMPUTERNAME%\IUSR_%COMPUTERNAME%:R]
  • c:\windows\temp, give (USR) write permissions or have "Upload error: Upload failed" messages after uploading with Upload Applet.

hints for setting filepermissions:

You should use XCACLS, not CACLS to set permissions, CACLS doesn't correctly set inheritance.

Get XCACLS here:

http://www.microsoft.com/downloads/details.aspx?amp;amp;displaylang=en&familyid=0ad33a24-0616-473c-b103-c35bc2820bda&displaylang=en

{{{ XCACLS.vbs <path to your website>\gallery /E /G IUSR_<computernamehere>:M

e.g.

XCACLS.vbs E:\inetpub\wwwroot\mysite.com\htdocs\gallery /E /G IUSR_WEBSERVER1:M }}}

advertisements