Forums / Install & configuration / Installing eZ publish version 3.1 (demo site) on Win2K IIS.

Installing eZ publish version 3.1 (demo site) on Win2K IIS.

Author Message

Dave Taylor

Wednesday 03 September 2003 3:35:18 am

Install Windows 2000 Professional

Install IIS

Install PHP Ver 4.3.2 (Use the windows installer maintaining all default settings)
You may need to manually configure IIS: - My Computer > Manage > Services and Applications > Internet Information Services > Default Web Site > Properties > Home Directory > Configuration > Add > Executable = c:\PHP\php.exe / Extension = .php
On slow machines, you may want to change the max_execution_time in c:/winnt/php.ini

Install mysql Ver 3.23.57 (maintaining all default settings)
Set-up the service by opening a command prompt at c:\mysql\bin
c:\mysql\bin>mysqld-nt -install
Start the service by:
c:\mysql\bin>NET START mysql (or start the service from Computer Management)
Set-up the database by:
c:\mysql\bin>mysql -u root
mysql> create database nextgen;
mysql> grant all on nextgen.* to nextgen@localhost identified by 'nextgen';
mysql> exit

Extract ezpublish-3.1-1.zip to c:\
Create folder c:\ezpublish-3.1-1\settings\override\

Install Imagemagick
Extract imagemagick.zip to a temp directory and copy the contents of ..\VisualMagick\bin\ to c:\WINNT\system32\

In IIS create a Virtual Directory "ez" and map to c:\ezpublish-3.1-1

Rename c:\ezpublish-3.1-1\lib\ezutils\classes\ezsys.php to original_ezsys.php
Create a new file ezsys.php containing the following:
Note: The sad face icon in ezsys.php should be a colon : then a open curly bracket ( with no spaces.

###########################################################################################################################
<?php
//
// Definition of eZSys class
//
// Created on: <01-Mar-2002 13:48:53 amos>
//
// Copyright (C) 1999-2003 eZ systems as. All rights reserved.
//
// This source file is part of the eZ publish (tm) Open Source Content
// Management System.
//
// This file may be distributed and/or modified under the terms of the
// "GNU General Public License" version 2 as published by the Free
// Software Foundation and appearing in the file LICENSE.GPL included in
// the packaging of this file.
//
// Licencees holding valid "eZ publish professional licences" may use this
// file in accordance with the "eZ publish professional licence" Agreement
// provided with the Software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
// THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE.
//
// The "eZ publish professional licence" is available at
// http://ez.no/products/licences/professional/. For pricing of this licence
// please contact us via e-mail to licence@ez.no. Further contact
// information is available at http://ez.no/home/contact/.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
// Contact licence@ez.no if any conditions of this licencing isn't clear to
// you.
//

/*!
\class eZSys ezsys.php
\ingroup eZUtils
\brief Easy access to various system settings

The system is checked to see whether a virtualhost-less setup is used
and sets the appropriate variables which can be fetched with
siteDir(), wwwDir() and indexFile().
It also detects file and enviroment separators, fetch them with
fileSeparator() and envSeparator().
In addition userIndexFile(), adminIndexFile() and xmlrpcIndexFile()
can be used to fetch the index file of the user page, admin page and
xmlrpc interface.

Example:
\code
// Run the init in the index file
eZSys::init( eZINI::instance() );
print( eZSys::indexFile() );
print( eZSys::wwwDir() );
\endcode
*/

define( "EZ_SYS_DEBUG_INTERNALS", false );

class eZSys
{
/*!
Initializes the object with settings taken from the current script run.
*/
function eZSys()
{
$this->Attributes = array( "magickQuotes" => true,
"hostname" => true );
// Determine OS specific settings
if ( substr( php_uname(), 0, 7 ) == "Windows" )
{
$this->OSType = "win32";
$this->FileSystemType = "win32";
$this->FileSeparator = "\\";
$this->LineSeparator= "\r\n";
$this->EnvSeparator = ";";
$this->BackupFilename = '.bak';
}
else if ( substr( php_uname(), 0, 3 ) == "Mac" )
{
$this->OSType = "mac";
$this->FileSystemType = "unix";
$this->FileSeparator = "/";
$this->LineSeparator= "\r";
$this->EnvSeparator = ":";
$this->BackupFilename = '~';
}
else
{
$this->OSType = "unix";
$this->FileSystemType = "unix";
$this->FileSeparator = "/";
$this->LineSeparator= "\n";
$this->EnvSeparator = ":";
$this->BackupFilename = '~';
}

$magicQuote = get_magic_quotes_gpc();

if ( $magicQuote == 1 )
{
eZSys::removeMagicQuotes();
}
}

function removeMagicQuotes()
{
$globalVariables = array( '_SERVER', '_ENV' );
foreach ( $globalVariables as $globalVariable )
{
foreach ( array_keys( $GLOBALS[$globalVariable] ) as $key )
{
if ( !is_array( $GLOBALS[$globalVariable][$key] ) )
{
$GLOBALS[$globalVariable][$key] = stripslashes( $GLOBALS[$globalVariable][$key] );
}
}
}
}

/*!
\static
\return the os type, either \c "win32", \c "unix" or \c "mac"
*/
function osType()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->OSType;
}

/*!
\static
\return the filesystem type, either \c "win32" or \c "unix"
*/
function filesystemType()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->FileSystemType;
}

/*!
Returns the string which is used for file separators on the current OS (server).
\static
*/
function fileSeparator()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->FileSeparator;
}

/*!
\return the backup filename for this platform, returns .bak for win32 and ~ for unix and mac.
*/
function backupFilename()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->BackupFilename;
}

/*!
Returns the string which is used for line separators on the current OS (server).
\static
*/
function lineSeparator()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->LineSeparator;
}

/*!
Returns the string which is used for enviroment separators on the current OS (server).
\static
*/
function envSeparator()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->EnvSeparator;
}

/*!
\static
\return the directory used for storing various kinds of files like cache, temporary files and logs.
*/
function varDirectory()
{
include_once( 'lib/ezutils/classes/ezini.php' );
$ini =& eZINI::instance();
return $ini->variable( 'FileSettings', 'VarDir' );
}

/*!
\static
\ return the directory used for storing various kinds of files like images, audio and more.
\Note This will include the varDirectory().
*/
function storageDirectory()
{
include_once( 'lib/ezutils/classes/ezini.php' );
include_once( 'lib/ezutils/classes/ezdir.php' );
$ini =& eZINI::instance();
$varDir = eZSys::varDirectory();
$storageDir = $ini->variable( 'FileSettings', 'StorageDir' );
return eZDir::path( array( $varDir, $storageDir ) );
}

/*!
\static
\return the directory used for storing cache files.
\note This will include the varDirectory().
*/
function cacheDirectory()
{
include_once( 'lib/ezutils/classes/ezini.php' );
$ini =& eZINI::instance();
$cacheDir = $ini->variable( 'FileSettings', 'CacheDir' );

include_once( 'lib/ezutils/classes/ezdir.php' );
if ( $cacheDir[0] == "/" )
{
return eZDir::path( array( $cacheDir ) );
}
else
{
return eZDir::path( array( eZSys::varDirectory(), $cacheDir ) );
}
}

/*!
The path to where all the code resides.
\static
*/
function siteDir()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->SiteDir;
}

/*!
The relative directory path of the vhless setup.
\static
*/
function wwwDir()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->WWWDir;
}

/*!
The filepath for the index file.
\static
*/
function indexDir()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->wwwDir() . $this->indexFile();
}

/*!
The filepath for the index file with the access path appended.
\static
\sa indexFileName
*/
function indexFile()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
$text = $this->IndexFile;
if ( count( $this->AccessPath ) > 0 )
{
// if ( $text != "" )
$text .= "?/";
$text .= implode( '/', $this->AccessPath );
}
return $text;
}

/*!
The filepath for the index file.
\static
*/
function indexFileName()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->IndexFile;
}

/*!
Returns the current hostname.
\static
*/
function hostname()
{
return eZSys::serverVariable( 'HTTP_HOST' );
}

/*!
\static
\return the port of the server.
*/
function serverPort()
{
$port =& $GLOBALS['eZSysServerPort'];
if ( !isset( $port ) )
{
$port = eZSys::serverVariable( 'SERVER_PORT' );
$hostname = eZSys::serverVariable( 'HTTP_HOST' );
if ( preg_match( "/.*:([0-9]+)/", $hostname, $regs ) )
{
$port = $regs[1];
}
}
return $port;
}

/*!
Returns true if magick quotes is enabled.
\static
*/
function magickQuotes()
{

}

/*!
\return the variable named \a $variableName in the global \c $_SERVER variable.
If the variable is not present an error is shown and \c null is returned.
*/
function &serverVariable( $variableName, $quiet = false )
{
$_SERVER;
if ( !isset( $_SERVER[$variableName] ) )
{
if ( !$quiet )
eZDebug::writeError( "Server variable '$variableName' does not exist", 'eZSys::serverVariable' );
return null;
}
return $_SERVER[$variableName];
}

/*!
Sets the server variable named \a $variableName to \a $variableValue.
\note Variables are only set for the current page view.
*/
function setServerVariable( $variableName, $variableValue )
{
$_SERVER;
$_SERVER[$variableName] = $variableValue;
}

/*!
\return the path string for the server.
*/
function &path( $quiet = false )
{
return eZSys::serverVariable( 'PATH', $quiet );
}

/*!
\return the variable named \a $variableName in the global \c $_ENV variable.
If the variable is not present an error is shown and \c null is returned.
*/
function &environmentVariable( $variableName, $quiet = false )
{
$_ENV;
if ( !isset( $_ENV[$variableName] ) )
{
if ( !$quiet )
eZDebug::writeError( "Environment variable '$variableName' does not exist", 'eZSys::environmentVariable' );
return null;
}
return $_ENV[$variableName];
}

/*!
Sets the environment variable named \a $variableName to \a $variableValue.
\note Variables are only set for the current page view.
*/
function setEnvironmentVariable( $variableName, $variableValue )
{
$_ENV;
$_ENV[$variableName] = $variableValue;
}

/*!
Return true if the attribute $attr is set. Available attributes are
wwwdir, sitedir or indexfile
*/
function hasAttribute( $attr )
{
return ( isset( $this->Attributes[$attr] )
or $attr == "wwwdir"
or $attr == "sitedir"
or $attr == "indexfile"
or $attr == "indexdir" );
}

/*!
Returns the attribute value for $attr or null if the attribute does not exist.
*/
function &attribute( $attr )
{
if ( isset( $this->Attributes[$attr] ) )
{
$mname = $attr;
return $this->$mname();
}
else if ( $attr == 'wwwdir' )
{
return $this->wwwDir();
}
else if ( $attr == 'sitedir' )
{
return $this->siteDir();
}
else if ( $attr == 'indexfile' )
{
return $this->indexFile();
}
else if ( $attr == 'indexdir' )
{
return $this->indexDir();
}
else
{
return null;
}
}

/*!
\static
Sets the access path which is appended to the index file.
\sa indexFile
*/
function addAccessPath( $path )
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
if ( !is_array( $path ) )
$path = array( $path );
$this->AccessPath = array_merge( $this->AccessPath, $path );
}

/*!
\static
\return true if debugging of internals is enabled, this will display
which server variables are read.
Set the option with setIsDebugEnabled().
*/
function isDebugEnabled()
{
if ( !isset( $GLOBALS['eZSysDebugInternalsEnabled'] ) )
$GLOBALS['eZSysDebugInternalsEnabled'] = EZ_SYS_DEBUG_INTERNALS;
return $GLOBALS['eZSysDebugInternalsEnabled'];
}

/*!
\static
Sets whether internal debugging is enabled or not.
*/
function setIsDebugEnabled( $debug )
{
$GLOBALS['eZSysDebugInternalsEnabled'] = $debug;
}

/*!
Initializes some variables according to some global PHP values.
This function should be called once in the index file with the parameters
stated in the parameter list.
\static
*/
function init( $def_index = "index.php" )
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();

if ( eZSys::isDebugEnabled() )
{
eZDebug::writeNotice( eZSys::serverVariable( 'PHP_SELF' ), 'PHP_SELF' );
eZDebug::writeNotice( eZSys::serverVariable( 'SCRIPT_FILENAME' ), 'SCRIPT_FILENAME' );
eZDebug::writeNotice( eZSys::serverVariable( 'DOCUMENT_ROOT' ), 'DOCUMENT_ROOT' );
eZDebug::writeNotice( ini_get( 'include_path' ), 'include_path' );
}

$phpSelf = eZSys::serverVariable( 'PHP_SELF' );

// Find out, where our files are.
if ( ereg( "(.*/)([^\/]+\.php)$", eZSys::serverVariable( 'SCRIPT_FILENAME' ), $regs ) )
{
$siteDir = $regs[1];
$index = "/" . $regs[2];
}
elseif ( ereg( "(.*/)([^\/]+\.php)/?", $phpSelf, $regs ) )
{
// Some people using CGI have their $_SERVER['SCRIPT_FILENAME'] not right... so we are trying this.
$siteDir = eZSys::serverVariable( 'DOCUMENT_ROOT' ) . $regs[1];
$index = "/" . $regs[2];
}
else
{
// Fallback... doesn't work with virtual-hosts, but better than nothing
$siteDir = "./";
$index = "/$def_index";
}

// Setting the right include_path
$includePath = ini_get( "include_path" );
if ( trim( $includePath ) != "" )
$includePath .= $this->envSeparator() . $siteDir;
else
$includePath = $siteDir;
ini_set( "include_path", $includePath );

$scriptName = eZSys::serverVariable( 'SCRIPT_NAME' );
// Get the webdir.
if ( ereg( "(.*)/([^\/]+\.php)$", $scriptName, $regs ) )
$wwwDir = $regs[1];
else if ( ereg( "(.*)/([^\/]+\.php)$", $phpSelf, $regs ) )
$wwwDir = $regs[1];

$requestURI = eZSys::serverVariable( 'QUERY_STRING' );

// take out PHPSESSID, if url-encoded
if( preg_match("/(.*)&PHPSSSID=[^&]+(.*)/",$requestURI,$matches ) ) {
$requestURI = $matches[1].$matches[2];
}

// Fallback... Finding the paths above failed, so $_SERVER['PHP_SELF'] is not set right.
if ( $siteDir == "./" )
$phpSelf = $requestURI;

// Remove url parameters
if ( ereg( "(\/[^&]+)", $requestURI, $regs ) )
{
$requestURI = $regs[1];
}

// Remove internal links
if ( ereg( "([^#]+)", $requestURI, $regs ) )
{
$requestURI = $regs[1];
}

$this->AccessPath = array();
$this->SiteDir =& $siteDir;
$this->WWWDir =& $wwwDir;
$this->IndexFile =& $index;
$this->RequestURI = $requestURI;

if ( eZSys::isDebugEnabled() )
{
eZDebug::writeNotice( $this->SiteDir, 'SiteDir' );
eZDebug::writeNotice( $this->WWWDir, 'WWWDir' );
eZDebug::writeNotice( $this->IndexFile, 'IndexFile' );
eZDebug::writeNotice( eZSys::requestURI(), 'eZSys::requestURI()' );
}
}

/*!
\return the URI used for parsing modules, views and parameters, may differ from $_SERVER['REQUEST_URI'].
*/
function requestURI()
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
return $this->RequestURI;
}

/*!
Initializes some variables which are read from site.ini
\warning Do not call this before init()
*/
function initIni( &$ini )
{
if ( !isset( $this ) or get_class( $this ) != "ezsys" )
$this =& eZSys::instance();
}

/*!
Returns the only legal instance of the eZSys class.
\static
*/
function &instance()
{
$instance =& $GLOBALS["eZSysInstance"];
if ( get_class( $instance ) != "ezsys" )
{
$instance = new eZSys();
}
return $instance;
}

/// The line separator used in files
var $LineSeparator;
/// The directory separator used for files
var $FileSeparator;
/// The list separator used for env variables
var $EnvSeparator;
/// The path to where all the code resides
var $SiteDir;
/// The access path of the current site view
var $AccessPath;
/// The relative directory path of the vhless setup
var $WWWDir;
/// The filepath for the index
var $IndexFile;
/// The uri which is used for parsing module/view information from, may differ from $_SERVER['REQUEST_URI']
var $RequestURI;
/// The type of filesystem, is either win32 or unix. This often used to determine os specific paths.
var $FileSystemType;
var $OSType;
}

?>
###########################################################################################################################

In order for search to work correctly, all form methods should be changed from "get" to "post". For example,
Edit c:\ezpublish-3.1-1\design\demo\override\templates\pagelayout_news.tpl and change:
<form action={"/content/search/"|ezurl} method="get">
to:
<form action={"/content/search/"|ezurl} method="post">

Browse to http://localhost/ez/index.php
Press "System Check"
At "Path to ImageMagick:" enter "c:\winnt\system32"
Press "check again" you should get no problems.
Press "Next"
Press "Language Options"
Select "Monolingual (one language)" (default setting) and press "Regional Options"
Select "Language Option" and Press "Summery"
Press "Setup Database"
Enter db name = nextgen, db user = nextgen and db password = nextgen
Press "Connect To Database"
Check "Install Demo Data" and Press "Continue"
Press "Configure"
Press "Site Details"
Enter the title of the site and the URL (http://<ip_address_or_name>/ez/index.php?/demo)
Press "Securing Site"
Press "Register Site"
Press "Skip Registration"
Press "Done"
Press "Disable Setup"

Browse to http://localhost/ez/index.php?/demo
Or from a remote client
Browse to http://<ip_address_or_name>/ez/index.php?/demo

You should now see the demo site.

To login, go to: http://<ip_address_or_name>/ez/index.php?/admin

Karsten Jennissen

Tuesday 09 September 2003 1:38:55 am

Thanks for your help! Could you please post this as a documentation page?

Dave Taylor

Wednesday 10 September 2003 2:33:42 am

Can somebody test this to confirm that it all works and is easily followed before being added to the documentation?

Graham Tillotson

Tuesday 16 September 2003 5:50:10 am

So far it is working well. I had the regular 3.1 version of ezPublish running, so I installed PHP, shut down Apache, and configured IIS to run the ezPublish pages (using the version of php.exe compiled for IIS). I'll post more comments as I work with the new setup.

One comment about the URL format -- I'm trying to setup an automated login via querystring variables, and in IIS the format of the base URL changes (path moves into the querystring). Here are examples for each web server:

Apache:
http://localhost/index.php/testcms?uguid=RKKK29292YY&state=MI&department=MARKETING

IIS:
http://localhost/ez/index.php?/testcms&uguid=RKKK29292YY&state=MI&department=MARKETING

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

Graham Tillotson

Friday 19 September 2003 6:40:25 am

One other thing -- be sure to grant Write privileges on the var directory for the Internet Guest Account so that log files can be updated.

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

Graham Tillotson

Friday 19 September 2003 3:35:16 pm

Yet another. You need to edit your search templates (standard or override) to adjust for the changes to the querystring. So, the standard URL strings (which pass the search text via querystring for pagination):

<a href={concat('/content/search/',$item_next|gt(0)|choose('',concat('offset/',$item_next)),'?SearchText=',$search_text_enc)|ezurl} class="body-copy">{"Next"|i18n("design/standard/navigator")} &gt;&gt;</a>

Use an ampersand instead of the question mark:
<a href={concat('/content/search/',$item_next|gt(0)|choose('',concat('offset/',$item_next)),'&SearchText=',$search_text_enc)|ezurl} class="body-copy">{"Next"|i18n("design/standard/navigator")} &gt;&gt;</a>

If you don't change the format of the querystring, you get a "no results found" message when navigating over search results pages.

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

Scott Heller

Friday 19 December 2003 8:23:21 am

Worked perfectly! Thanks