Upgrading MySql

Apparently the last time I set up MySql I did it using some cheap (like crappy) installer. It didn’t include any of the extension dlls. I’ve now decided it is much less of a headache to simply download the zip file and do the configuration myself. A link to the instructions I followed. Worked great when I did so.

Installing PHP.

The path used for PHP is just an example, you can choose another if you want.

  • Extract the archive in C:\PHP (Rename it if necessary)
  • Rename C:\PHP\php.ini-recommended to C:\PHP\PHP.INI

Configure the Session directory

  • Open C:\PHP\PHP.INI

Make sure you remove the initial semicolons!

  • Find
;session.save_path = "/tmp"

replace it with

session.save_path = "C:\WINDOWS\TEMP"
  • Find
; **You CAN safely turn this off for IIS, in fact, you MUST.**
; cgi.force_redirect = 1

replace it with

; **You CAN safely turn this off for IIS, in fact, you MUST.**
cgi.force_redirect = 0

Configure PHP extensions

  • Find
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"

replace it with

; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\PHP\EXT"

If you can’t find “extension_dir” in your C:\PHP\PHP.INI file, add it to the bottom of the file.

MySQL extension

As Gallery 2 uses a database to store it’s metadata, you need to enable database support in PHP. This guide uses MySQL, but the procedure would be similar for Postgres or Oracle.

  • Find
;extension=php_mysql.dll

replace it with

extension=php_mysql.dll

Gettext extension

  • In order to make the localization of g2 (multi-language) work you need the gettext extension of php. This can be enabled in php.ini. G2 does hint you for that. However gettext is a little strange extension.
  • Find
;extension=php_gettext.dll

replace it with

extension=php_gettext.dll

But now comes the crux. php_gettext.dll is depending on \php-install-dir\dll\iconv.dll All other extensions work flawlessly for me. But gettext.dll required me to put iconv.dll into a dir that is included in the searchpath. E.g. /windows/system32 I then overreacted and copied all dll’s to that /system32 dir. The manual of php 4 tells you to copy the dll’s to the /php-install-dir/ but that only works if you add manually the php dir into the path statement of windows.

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

....

Make PHP available to IIS

Set the system path to include C:\PHP

  • Click on My Computer -> Properties -> Advanced -> Environment Variables
  • Scroll down the System Variables (bottom window) and doubeclick on the PATH variable
  • Add the following to the end (make sure you add the initial semicolin)
;C:\PHP
  • Click OK

Make PHP.INI available to PHP

  • While you still have the Environment variables window open click new
  • In the Variable Name field enter
PHPRC
  • Set the Variable Value to
C:\PHP

This will make PHP.INI available to PHP (We will verify this later)

Configuring IIS

You have a choice of whether to setup PHP to use the ISAPI extension, CGI executable, or using FastCGI. The ISAPI extension is not fully stable, and the CGI executable’s performance is very poor because after every request the php-cgi.exe executable is unloaded. So if the php-cgi.exe executable is always loaded into memory then that would greatly increase the performance. There are two ways of doing this.
1. Spend $500 for Zend’s own WinEnabler [2]
2. Setup the free FastCGI program that does the same thing as WinEnabler

The recommended way of running PHP on IIS is using FastCGI. Below you will find instructions on how to setup PHP using ISAPI but if your site is going to serve lots of pages, you will probably want to go with FastCGI.

Add the PHP ISAPI extension to IIS Web Service Extensions

  • Click on Start -> Administrative Tools -> Internet Information Services (IIS) Manager
  • Expand the local computer in the left pane
  • Click on “Web Service Extensions” in the left pane
  • In the right pane, click the blue underlined text, “Add a new Web service extension…”
  • Enter “PHP5 ISAPI” as the “Extension name”
  • Click the “Add…” button and browse to the php5isapi.dll file in your C:\PHP install directory
  • Click Open -> OK
  • Check the “Set extension status to Allowed” checkbox and click “OK”

Adding the PHP parsing to your IIS website

Note: You can add this either on the top-level Web Sites or to individual web sites beneath it. If you add it to the top-level web sites node in the left pane, it applies to all websites on the IIS instance. You can also choose to only install it on specific websites beneath the top-level node, in that case it will only apply to that site. The procedure for adding is the same for both scopes.

Be careful when applying this to the top-level node, as it will override settings defined in the individual websites beneath it.

  • In the left pane, expand Web Sites
  • Right Click the website you want to configure, and select properties
  • Open the Home Directory tab
  • Click Configuration
  • Then go to the Mappings tab
  • Click Add…
  • Enter the full path to php5isapi.dll in the “Executable” textbox or click the Browse button to browse your way to it. If you have followed the path recommendations in this guide, the fill path should be C:\PHP\php5isapi.dll
  • Enter .php in the Extension textbox
  • Select Limit to, enter GET,POST,HEAD
  • Click OK and verify that .PHP is now included in the Application extensions listbox
  • Click OK

This configures IIS to understand what to do with files ending with .php

Adding scripting permissions

  • While still having the Web Site Properties dialog box open, click Home Directory
  • Make sure that “Execute permissions” dropdown is set to “Scripts only”.
  • Click OK

Leave a Reply

Your email address will not be published. Required fields are marked *