larger smaller normal text version of this page
phplist Hacks

This document was taken from here

PHPList Installation on Windows/IIS

by James R. Erickson (jre@goldengate.net)
  • 1st draft, Feb 16 2005
  • 2nd draft, Mar 9 2005
    • Matched line numbers with virgin source code and cross-checked code with files.

Introduction


Below are some steps you should take to get PHPList up and running on a
Windows/IIS system. These steps were developed from notes taken while
getting PHPList 2.9.3 running correctly on a Windows 2000 server with IIS 5.0
using PHP version 4.3.6.

Please note: Some of the steps list line numbers in PHPList source files.
Since the source files change with every version, these line numbers are
approximate. Also, some steps may prove to be unnecessary if the
developers choose to integrate some of the changes into the base program.

Contents

  • Initial Installation
  • Getting it Working on Windows
  • Using Exchange Server
  • Configuration
  • Security
  • Credits

Initial Installation


The first thing you need to do is set up PHP under IIS. The PHP installation
instructions for Windows are pretty good, so dig them up along with the PHP
install files. One thing you need to do is uncomment the line
'extension=php_imap.dll' in the php.ini file. The imap extension for PHP
contains the pop3 functions necessary for PHPList bounce processing.

Second, you need to install and configure MySQL on your database server.
Again, use the instructions included with MySQL to install and configure
it on your server. For security reasons, its best if you create a user
within MySQL specifically for the use of PHPList. See the MySQL
documentation for info on how to do this.

Next, use the general PHPList installation instructions as given on the
PHPList web site. Obviously those directions are for LAMP systems, but if
you don't understand IIS enough to translate them to IIS, then you will have
a very hard time with the rest of these instructions. Its basically creating
a website, or a new application under your existing website, and copying
over the PHPList files. Note that these steps assume you place the PHPList
files in a '/lists' folder under the root of your website. If you do not
use this default location, you will need to adjust the steps to compensate,
as well as set the '$pageroot' and '$adminpages' options in the config.php
file.

Getting it Working on Windows


0. Before making any changes to any of the source files, be sure to make
backup copies.

1. Make sure you set the "$form_action = 'index.php';" option in the
/lists/config/config.php file.

2. In the IIS Admin program, go to the properties of the /lists folder and
set the default document to 'index.php'. You might as well remove any
other default documents so only index.php remains.

3. If you are on a live server, you may want to visit the Security section
below at this time, at least to lock down your /lists/admin folder.

4. There is a very good thread under the Docs, Tips and Tricks forum called
"FORMS -- Possible IIS solution found" (#251) that you may want to read.
It brings up some very good issues and explains some of what will need
to be changed in the steps below and much of this document is based
on the work of posters to that thread (credited below).

5. Edit the following lines in the /lists/admin/connect.php file to read as below if
they don't already (line numbers are approximate due to differences
in PHPList versions):
  • LINE 169: $html = sprintf('<form method=post action="%s" %s>',$form_action,$additional);
  • LINE 179: $html = sprintf('<form method=post action= %s>',$additional);
  • LINE 399: $html .= $spb.sprintf('<a href="index.php%s">%s</a>',getConfig("subscribeurl"),$GLOBALS["strSubscribeTitle"]).$spe;
  • LINE 453: return sprintf('<a href="index.php?page=%s%s">%s</a>',$name,$url,strtolower($desc));
  • LINE 470: return sprintf('<a href="index.php?page=%s%s" target="phplistwindow">%s</a>',$name,$url,strtolower($desc));

6. Edit the following lines in the /lists/admin/lib.php file to read as below if
they don't already (line numbers are approximate due to differences
in PHPList versions):
  • LINE 253: $template = eregi_replace("\[UNSUBSCRIBE\]",sprintf('<a href="index.php%s">%s</a>',getConfig("unsubscribeurl"),$GLOBALS["strThisLink"]),$template);
  • LINE 254: $template = eregi_replace("\[PREFERENCES\]",sprintf('<a href="index.php%s">%s</a>',getConfig("preferencesurl"),$GLOBALS["strThisLink"]),$template);

7. Bulk-replace all incidents of the text "_GET[" with "_REQUEST[" in
all the files in the /lists/admin folder. This step is easier if you
have a good code editor that can do search and replace across multiple
files. Don't include the quotes, of course, but be sure to include the
_ and [ characters, since there are 'get' substrings that you don't want
to replace.

8. Edit the following line in the /lists/admin/login.php file to read as
below if it doesn't already:
  • LINE 18: <form method="post" action="index.php">

9. Edit the following lines in the /lists/admin/spageedit.php file to read
as below if they don't already:
  • LINE 1: <form method=post action="<?php echo $_SERVER["SCRIPT_NAME"]; ?>">
  • Add the line (under the above line): <input type="hidden" name="page" value="spageedit">

10. Edit the following lines in the /lists/admin/send.php file to read
as below if they don't already:
  • Add the line (right at the top): <input type="hidden" name="page" value="send">

11. Edit the following lines in the /lists/index.php file to read as
below if they don't already:
  • LINE 485: $_POST["unsubscribeemail"] = $email;
  • LINE 490: if ($_POST["unsubscribe"] && $_POST["unsubscribeemail"] && isset($_POST["unsubscribereason"])) {
  • LINE 491: $email = trim($_POST["unsubscribeemail"]);
  • LINE 528: } elseif ($_POST["unsubscribe"] && !$_POST["unsubscribeemail"]) {
  • LINE 533: if ($_REQUEST["unsubscribeemail"]) {
  • LINE 534: $email = $_POST["unsubscribeemail"];

12. Also in /lists/index.php, under the line (323)
$html .= formStart('name="subscribeform"');
Add the line:
$html .= '<input type="hidden" name="uid" value="'.$_REQUEST["uid"].'">';

13. If you will be requiring administrators to have separate logins to PHPList,
in /lists/admin/admins.php, change line 7 to read:
$external = FALSE;

14. In /lists/admin/processbounces.php, you can set the bounced user process delay
by changing the number after the word "INTERVAL" on line (342) that reads:
where (date_add(entered,INTERVAL 5 day) < now())
Changing it to the following will process bounced users immediately:
where (date_add(entered,INTERVAL 0 day) <= now())

20. For FCKeditor integration, add the following line to
/lists/admin/send_core.php (about line 719) and /lists/admin/template.php
(about line 175) - edited to match your path if necessary:
$oFCKeditor->BasePath = '/lists/admin/FCKeditor/';

25. To use templates with text messages instead of just HTML messages, edit
the /lists/admin/sendemaillib.php as below:
  • Uncomment the line that reads (584): $text = preg_replace("/\n/","#NL#",$text);
  • Comment out the line that reads (146): $textmessage = $textcontent;
  • Immediately under the above line, enter the following code:
  • if ($cached[$messageid]["template"])
    # template used
    #remove HTML from Template and insert text in the [content]
    $textmessage = eregi_replace("\[CONTENT\]",$textcontent,stripHTML($cached[$messageid]["template"]));
    else {
    # no template used
$textmessage = $textcontent;
}

50. For autoprocessing, consider using WGet along with something like
nnCron. Either that, or you can try and port the included scripts
into a Windows batch file.

98. Make any desired changes to the /lists/styles/phplist.css file

99. Make any desired changes to the language files in /lists/texts/ folder.
Many of the entries can take styles (with <span> tags) to alter their
appearance as well as their text.

Using Exchange Server


If you will be relaying messages through an Exchange Server, or the
ultimate destination of any bounces is a mailbox on an Exchange Server,
then consider doing the following:

For correct message formatting:
  • In the /lists/config/config.php file, change the "HTMLEMAIL_ENCODING"
  • to "base64" from "quoted-printable".

For correct bounce processing:
  • In the file /lists/admin/sendemaillib.php, under the code that reads (starts at line 105) :
  • if (!EMAILTEXTCREDITS) {
    $html["signature"] = $PoweredByImage;#'<div align="center" id="signature"><a href="http://www.phplist.com">Powered by PHPlist # oops, accidentally became spyware, never intended that, so take it out again :-)
    $html["signature"] = preg_replace('/src=".*power-phplist.png"/','src="powerphplist.png"',$html["signature"]);
    } else {
    $html["signature"] = $PoweredByText;
    }
    Insert the lines:
    $html["signature"].= "\nX-MessageID: ".$messageid."\n";
    $html["signature"].= "\nX-ListMember: ".$email."\n";
    $text["signature"].= "\nX-MessageID: ".$messageid." -\n"; #space before -
    $text["signature"].= "\nX-ListMember: ".$email." -\n"; #space before -
  • In the /lists/admin/processbounces.php, change the following lines:
    • LINE 84: From:'preg_match ("/X-MessageId: (.*)/i",$body,$match);'
    • To: 'preg_match ("/X-MessageId: (\S*)/i",$body,$match);'
    • LINE 89: From:'preg_match ("/X-Message: (.*)/i",$body,$match);'
    • To: 'preg_match ("/X-Message: (.\S*)/i",$body,$match);'
    • LINE 94: From:'preg_match ("/X-ListMember: (.*)/i",$body,$match);'
    • To: 'preg_match ("/X-ListMember: (\S*)/i",$body,$match);'
    • LINE 99: From:'preg_match ("/X-User: (.*)/i",$body,$match);'
    • To: 'preg_match ("/X-User: (\S*)/i",$body,$match);'

Configuration


Configuration on a Windows server is pretty much the same as on a non-Windows
server. Basically you set the parameters in the /lists/config/config.php
file, and you change the settings in on the 'configure' page within PHPList.
Listed here are some tips gleamed from various posts on the PHPList forums
that may ease your installation.

'configure' page:
- Website address: this should be the address of your server, such as
'www.example.com'. Do not use 'http://'. Also, you don't need to append
the directories on the server (e.g. do not add '/lists/' to the address)
- Domain Name: this should be the basic domain name people use to send
email to your domain. 'example.com'
- Person in change of this system, Who gets the reports, From email
address for system messages, Reply-to-email address for system
messages: these all need to be valid email boxes wherever you want
these messages to be sent.
- Base URL for public pages: this is similar to the first option, but here
you want to add the 'http://' and directory name.
'http://www.example.com/lists/'

/lists/config/config.php
- Change the 'database_host', 'database_name, 'database_user', and
'database_password' options based on your MySQL installation and the
database and user you created in the initial installation.
- If you did not use the default file location ('/lists'), you will need
set the $pageroot and $adminpages options on lines 46 & 47.
- When you want to start sending out real messages, change the
'define ("TEST",1);' option to 'define ("TEST",0);'
- As mentioned in the Exchange Server section above, if you will be
relaying messages through an Exchange Server, or the ultimate
destination of any bounces is a mailbox on an Exchange Server then
consider changing 'define("HTMLEMAIL_ENCODING","quoted-printable");'
to 'define("HTMLEMAIL_ENCODING","base64");'


Security


Be sure to read the README.security file included with PHPList. While you
will not be able to implement everything on the list given in that file,
since you are running IIS and not Apache, you can implement much of it, and
it will make you aware of issues that you need to think about.

1. In your php.ini file, set the 'register_globals' parameter to 'Off'

2. Within PHPList, reset the password for the Admin user.

3. Clear your /lists folder of all files except the 3 php files:
'index.php', 'dl.php', and 'ut.php'.

4. In the IIS Admin program, change the Directory Security properties of the
folders listed below. Set the IP Address restrictions so all addresses
are denied except those in the list. Add the primary address of the
server to the list, as well as 127.0.0.1 (the loopback). Also add the
address of any system from which you wish to administer PHPList.
  • /lists/admin/
  • /lists/admin/help/
  • /lists/admin/onyxrss/
  • /lists/admin/plugins/

5. If you wish to set account/password security on the admin folders as well,
create the necessary accounts on the server, change the NTFS permissions
as desired and change the 'Anonymous access and authentication control'
settings in the Directory Security properties.

6. In the IIS Admin program, change the File Security properties of the
files /lists/ut.php and /lists/dl.php. Set the IP Address restrictions
so all addresses are denied except those in the list. Add the primary
address of the server to the list, as well as 127.0.0.1 (the loopback).

7. Repeat step 6 for the Directory Security of the following folders:
  • /lists/config/
  • /lists/texts/
  • /lists/admin/commonlib/

Credits


Many of the ideas contained in this document came from posters to the PHPList
forums. Those I directly lifted code or ideas from, are listed here by the
names they used when posting to the forums. If I forgot anyone, I apologize.
Please let me know if you feel you should be included or would like your name
taken off the list.

In no particular order:
  • mathiaspalm
  • valletta
  • eirinikos
  • hqnetwork
  • kevind42
  • alvion
  • drichter
  • weweje
  • jre (me)

And, of course, the folks who wrote phplist to begin with.

CategoryHacks
funny sayings big bang theory quotes funny jokes hilarious quotes quotes to live by

































Page was generated in 0.0952 seconds