segunda-feira, 17 de março de 2008

PHP + MySQL + IIS6 + MediaWiki in Windows Server 2003

Used:

Windows Server 2003 Web Edition (with SP2)
MySQL 5.0.24
PHP 5.2.5


Install MySQL 5.0.24

Install MySQL to the default directory using the default options:

  1. Complete the installation by pressing "Next" all the way thru
  2. Select “Detailed Configuration”
  3. Choose “Developer Machine”
  4. Choose “MultiFunctional Database”
  5. Select path for Data, this configuration used the default location.
  6. Choose “Decision Support (DSS)/OLAP
  7. Enable TCP/IP Networking on 3306 and Enable Strict Mode
  8. Enable standard character set
  9. Install as a Windows Service and set to launch automatically, check “Include Bin Directory in Windows PATH”
  10. Enter a Root Password
  11. Create the setup
  12. You may need to edit the Windows Firewall settings to allow for TCP port 3306 to be opened for the installation to complete.

Install PHP 5.2.5

  1. Change the install folder to C:\PHP
  2. Select IIS CGI from the list of WebServers
  3. Expand Extensions and select “MySQL” to install, but note other extensions may be useful but can be added later. Hint: If you plan on using Active Directory authentication later on, be sure to select “LDAP”, “OpenSSL” and “MCrypt” now. If you add them later, not all necessary files are copied. You can get these files by performing a reinstall, but this will mess up your php.ini file.
  4. Install all extras (PHP Manual and PEAR)
  5. In explorer create folders C:\PHP\sessiondata and C:\PHP\uploadtemp
  6. Select both folders, right click, and choose properties. On the Security tab grant user IUSR_Modify” rights to both folders
  7. In Notepad open C:\PHP\php.ini
  8. Find the line “;cgi.force_redirect = 1” and uncomment it, change the value of “1” to “0
  9. Find the line “upload_tmp_dir="C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\upload"” and change to “upload_tmp_dir="C:\PHP\uploadtemp"
  10. Change the next line to read: “session.save_path="C:\php\sessiondata"

NOTE: Search PHP.INI for other instances of session.save_path and upload_tmp_dir. Comment them out, if found.

  1. Save PHP.INI

Install mail and net_smtp pear modules

  1. From Internet Explorer goto: http://pear.php.net/go-pear
  2. Copy entire webpage, and paste into file: c:\php\pear\go-pear.bat
  3. From Command Line, do the following:
c:
cd \php
.\php pear\go-pear.bat
pear install mail
pear install net_smtp

Install MediaWiki in IIS

  1. Extract MediaWiki from its downloaded file and place the entire folder in C:\Inetpub\wwwroot\mediawiki
  2. Right click on this folder. Add IUSR_ to the permissions list with "Read & Execute" permissions
  3. Open IIS Manager
  4. Stop the Default Website
  5. Right click on “Web Sites” and choose New, Website
  6. Call it “MediaWiki
  7. Select the path “C:\Inetpub\wwwroot\mediawiki
  8. Allow the permissions Read and Execute
  9. Right click on MediaWiki and choose Properties
  10. On the Documents tab add “index.php” as the default content page and move to the top of the list
  11. Save settings and exit IIS Manager
  12. Enable write permissions on the C:\Inetpub\wwwroot\mediawiki\config folder (at least during the setup process).
  13. Run “iisreset
  14. From ANOTHER MACHINE navigate to http:// Note: My machine was a virtual Windows 2000 Professional SP4 installation with the machine joined to the domain and logged on using a domain user account.
  15. Configure MediaWiki as to your needs
  16. Copy LocalSettings.php from C:\Inetpub\wwwroot\mediawiki\config to C:\Inetpub\wwwroot\mediawiki
  17. Navigate back to http://
  18. You are good to go…

Troubles & Solutions

Error in my_thread_global_end(): 1 threads didn't exit

Using PHP 5.2.3 and MYSQL 5.0.24, ran into the issue where the http page request for each wiki page would hang for about 5 seconds before closing the connection, then finally display a message at the bottom of the page "Error in my_thread_global_end(): 1 threads didn't exit".

The fix for this was

  1. Download the PHP 5.2.1 Windows binary
  2. Rename your c:\php\libmysql.dll to c:\php\libmysql.dll_old
  3. Unzip and copy libmysql.dll from the 5.2.1 version to c:\php\libmysql.dll

Fix Email problem when using IIS SMTP Relay / Exchange

If you are having problems getting email notifications working and receive and error message of Invalid Address 5.5.4 (when using MediaWiki 1.6.5) then you can edit includes/UserMailer.php around line 45:

Before:

class MailAddress {
/**
* @param mixed $address String with an email address, or a User object
* @param string $name Human-readable name if a string address is given
*/
function MailAddress( $address, $name=null ) {
if( is_object( $address ) && is_a( $address, 'User' ) ) {
$this->address = $address->getEmail();
$this->name = $address->getName();
} else {
$this->address = strval( $address );
$this->name = strval( $name );
}
}

After:

class MailAddress {
/**
* @param mixed $address String with an email address, or a User object
* @param string $name Human-readable name if a string address is given
*/
function MailAddress( $address, $name=null ) {

#To get round IIS SMTP Invalid Address Problem
$this->name = "";
if( is_object( $address ) && is_a( $address, 'User' ) ) {
$this->address = $address->getEmail();
} else {
$this->address = strval( $address );
}
}

acknowledgement

segunda-feira, 11 de fevereiro de 2008

DotNetNuke Development Notes (Part I - DNN & IIS)

Used:
Windows XP Professional
Microsoft Internet Information Services (IIS 6)
Visual Studio 2008
DotNetNuke 4.8.0 Source Package

I. Install IIS6 (if not already installed) before installing VS2008 and any other ASP.NET stuff

II. Create a a new Physical Folder, preferentialy under C:\Inetpub (e.g. C:\Inetpub\DNN), and extract the .zip (Website and Library Folders, and two solution files) into that folder.

III. Create a new Virtual Folder via IIS (Control Panel -> Admin Tools -> IIS Manager) providing the path to the previously created physical folder, \Website (e.g. C:\Inetpub\DNN\Website) with at least Read, Run scripts and Execute permissions. After that, in Website properties, make sure the Web Site's ASP.NET version is 2.0.50727

IV. Rename release.config to web.config

V. In a web browser (IE or Firefox) go to http://localhost/Website (e.g. http://localhost/DNN/)

VI. Select the automatic install option, the website will be installed.