TWIG FAQ

-----------------------------------------------------------------------------

    Q: I just upgraded from an older TWIG, and I get the error:
       "Unable to find context data". I was using php4session handlers.

    A: The php4ession provider never worked properly, and has been removed
       from the source tree. It more than just didn't work, it sometimes
       caused data loss! Suggested alternative are:
        $config["session_handler"] = "get2" or "sqltable"
        $config["login_handler"]   = "securecookie.sqltable" or "sqltable"

-----------------------------------------------------------------------------

    Q: I have a lot of Contacts entries, but I don't see any of them in
       the Meetings feature. I suspect that my database might be corrupted!

    A: Fear not! Your database is probably perfectly healthy. The Meetings
       feature only lists a specific type of Contact, called the My Contact
       which is set for each user in their Preferences, My Contact page.

-----------------------------------------------------------------------------

    Q: Why does TWIG crash when I send an email to more than 100 recipients?

    A: Actually, it's not TWIG that's crashing, but the IMAP module within
       PHP. Contributor Russell Moseman tracked down the bug, and his fix
       is scheduled to be included in PHP 4.3.0 and higher.

-----------------------------------------------------------------------------

    Q: I've heard that a single TWIG installation can serve many domains
       using my webserver's virtual hosts settings. Is there any
       documentation for this functionality?

    A: There sure is: twig/docs/virtualhosts.txt

-----------------------------------------------------------------------------

    Q: I followed the directions for setting up virtual hosts with Apache,
       but every virtual host comes up with the default settings. What's
       going wrong?

    A: Check the value of the UseCanonicalName directive in your httpd.conf.
       If it is set to On try changing it to Off.

-----------------------------------------------------------------------------

    Q: I want to use TWIG with my POP3 server. How do I do that?

    A: In your twig/config/config.inc.php3, use these settings:
       $config["imap_servertype"] = "php-pop3";
       $config["imap_server"]     = "your.mail.server.com.net.org";
       $config["imap_port"]       = "110";

-----------------------------------------------------------------------------

    Q: I just upgraded to PHP 4.2.x, and TWIG used to work great but now I
       can't even get past the login screen! What happened?

    A: PHP now comes with the php.ini setting for register_globals = off, 
       but TWIG relies on having register_globals = on. Make this change in
       your php.ini and restart your httpd and everything should work again!

-----------------------------------------------------------------------------

    Q: How can I make the cursor jump directly to the username field of the
       login form, just like the home page of the Google search engine?

    A: Add this script to the end of twig/config/login.form.inc.php3:
       <SCRIPT TYPE="text/javascript">
       <!--
       document.login_form.login_username.focus();
       // -->
       </SCRIPT>

-----------------------------------------------------------------------------

    Q: I'm using Internet Explorer version one million and something. I have
       not installed any of the service packs. Why isn't TWIG working right?

    A: It has been our experience that no matter what version of IE you
       have, unless there's a service pack level 2 or higher, IE is broken.

-----------------------------------------------------------------------------

    Q: I just upgraded to RedHat Linux 7.3 and TWIG mostly works, but
       when I complete some of the forms for adding items, like in Contacts,
       or for sending mail, I get thrown back to the Main feature. Why?

    A: RedHat 7.3 comes with multipart forms "Off" by default. TWIG
       relies on these multipart forms to handle complex forms and to take
       file uploads for email attachments. In your php.ini, change this:

       [File Uploads]
       ...
       file_uploads = On
       ...

-----------------------------------------------------------------------------

    Q: I just upgraded to RedHat Linux 7.3 and now TWIG says this:
       Warning: Couldn't open stream {localhost:143}INBOX in
       /var/www/html/twig/lib/mail/php-imap.inc.php3

    A: See the next entry. RedHat 7.3 comes with TLS enabled by default.

-----------------------------------------------------------------------------

    Q: All my other IMAP clients can connect to my server, but TWIG says:
       Warning: Couldn't open stream {localhost:143}INBOX in
       /var/www/html/twig/lib/mail/php-imap.inc.php3

    A: Your server probably has Transport Layer Security turned on, but
       PHP does not support TLS. You'll need to edit config.inc.php3:
             
     	$config["imap_port"] = "143/notls";

-----------------------------------------------------------------------------

    Q: How do I disable the {news/contacts/etc.} feature?

    A: Edit config.inc.php3 and at the bottom add in a line like the 
       following:
             
     	$disabled["news"] = 1;

-----------------------------------------------------------------------------

    Q: What options can I disable in config.inc.php3?

    A: Here is a list of the features that are controllable this way:

		bookmarks
		bookmarks_edit
		bookmarks_prefs
		contacts
		contacts_edit
		contacts_import
		contacts_prefs
		FindHTML
		global_autoaccounts
		global_goto
		global_groups
		global_newmailcheck
		groups
		groups_edit
		mail
		mail_compose
		mail_delete
		mail_expunge
		mail_folders
		mail_foldover
		mail_fromaddress
		mail_msgview
		mail_prefs
		mail_refresh
		mail_secondcmdline
		mail_showattach
		mail_transfer
		mail_transfer_to
		mail_treeview
		mail_readreceipts
		main_feature
		main_prefs
		main_recentmail
		main_schedule
		news
		news_manage
		news_prefs
		schedule
		schedule_day
		schedule_edit
		schedule_prefs
		schedule_week
		schedule_list
		schedule_cal
		schedule_maint
		todo
		todo_edit
		todo_prefs

-----------------------------------------------------------------------------

    Q: Is there a Setup-Apache-PHP-IMAP-pgSQL-TWIG.txt file?

    A: Yes! At this time (version 2.4.1) this file does exist, look in the
       doc directory.

-----------------------------------------------------------------------------

    Q: Everything seems to be working fine except when I go
       in to Mail, Folder Management TWIG seems to hang... 

       OR

       Everything seems to be working fine except when I go
       in to Mail, Folder Management a listing of my home directory
       appears instead of my folder list... 


    A: This is likely caused by an incorrect setup of 
       $config[imap_path].  For example, if you are using
       the University of Washington's IMAP server and have 
       set $config[imap_path] to "/" then the IMAP server 
       will be trying to retrieve a complete directory tree
       of your server starting at the root directory.

       Set $config[imap_path] to be either blank ("") or a
       subfolder of the current directory ("Mail/").

-----------------------------------------------------------------------------

    Q: I've set up TWIG and the login page comes up ok, but it will never
       let me get past it.  I'm sure I've setup twig correctly and that I'm
       use the right name and password but it still doesn't work, what's 
       wrong?
 
    OR

    Q: I login to twig fine, but when i click on any of the links, it jumps 
       back to the login screen. I'm sure I've setup twig correctly and that
       I'm use the right name and password but it still doesn't work, what's 
       wrong?

    A: Check your cookie settings, twig uses cookies to store login info, if
       your browser (or your firewall) disables them then it you have to use
       basic auth.

       Additionally, make sure the time, date, and timezone on both the
       web server and the workstation are correct.  The workstation and
       web server can be in different timzones, but they both must be
       set to something close to the correct time.  By default, TWIG's
       cookies expire after one hour, so a clock discrepency of an hour
       or more can cause the cookies to immediately expire.  In most
       configurations, you can test whether this is a time related
       problem by setting:

             $config["auth_timeout"] = 0;

       in your config/config.inc.php3.  This disables login timeouts in
       most configurations.  If that setting fixes your problem, then you
       know for certain that the problem is related to a discrepency in
       the time, date, or timezone settings on either the workstation or
       the web server.
       
       Some machines (like Acorn RISC OS)  are unable to understand anything
       other than GMT - so you either have to use GMT on the server and
       workstations, or increase or disable the timeout in
       config.inc.php3.

       One additional situation that can cause this behavior is if
       register_globals = Off in your php.ini.  At this time TWIG
       simply needs for register_globals to be turned on in order for
       many things, including logins, to work.  (Don't forget to
       restart your web server after making any changes to you PHP
       configuration!)

-----------------------------------------------------------------------------

    Q: I added an item to (schedule/bookmarks/etc.) and every time I hit
       the reload button it gets added again.  What's wrong?
 
    A: As the doctor said, don't do that!  When you add an item in TWIG the
       data is sent as a POST form, each time you hit reload on your browser
       it reposts the data, re-adding the item.  You should NEVER use the
       back button in TWIG, always uses on of the supplied links to get back
       to where you want to be.

-----------------------------------------------------------------------------

    Q: I've set everything up but when I point my web browser to TWIG's 
       directory I get a directory listing instead of the login screen.

    A: Most likely your web server is not recognizing index.php3 as a
       default file type.  For Apache you can check the following line
       in httpd.conf:

	DirectoryIndex index.html index.htm index.php3

-----------------------------------------------------------------------------

    Q: What does the groups command do at the main screen?

    A: The groups command can create group "groupname" and add twig users to 
       that group.  Then those users will be able to view and post items to
       the schedule, todo list, contacts, and bookmarks of all members of the
       group.  The information is filed with the group name.  When you select
       a group to view on one of the other pages (say contacts), it shows you
       all contacts posted by members of that group.  If you select ALL, it
       shows you all of your contacts, including all of those posted onto all
       groups you are a member of.  Unfiled = all those items that you posted
       only for yourself (and not for a group).

-----------------------------------------------------------------------------

    Q: I've read the Setup-*-TWIG.txt files, but do I really
       need to start from the source code?

    A: No, many Linux distributions have packages that allow you to install
       binary files instead of compiling the software from scratch, however
       these setup files were built assuming as little as possible and
       therefore start from the source distributions for everything.

-----------------------------------------------------------------------------

    Q: I'm using  browser X and I don't seem to be able to use the forms
       login method.

    A: TWIG uses cookies and authentication, some browsers seem to be broken
       in their implementations of these features.  If possible try another 
       browser and see if that helps.

-----------------------------------------------------------------------------

    Q: All my sent mail seems to be saved to mailsent-mail, why?

    A: Most likely you have set your $config["imap_path"] to "Mail" 
       instead of "Mail/", make sure the ending slash is there.

-----------------------------------------------------------------------------
  
    Q: What options can I use in the date display fields in config.inc.php3?

    A: These fields get passed to php's date() function, please refer to
       http://www.php.net/manual/function.date.php3 for more details.

-----------------------------------------------------------------------------
  
    Q: What versions of the various support programs does TWIG need?

    A: TWIG uses several support programs, here is a list with recommended
       version for use with TWIG.  

       Note: The recommended version is simply what the developers used to 
	     build TWIG and hence have the most testing with TWIG.

						Recommended 
	Program					Version
	--------------				-----------
	PHP3					3.0.12, 3.0.16, 3.0.18
	PHP4					4.0.3pl1
	MySQL					3.22.21
	postgresql				6.4.2
	University of Washington's IMAP Server	4.7
	Cyrus IMAP Server			1.5.14
	
       This does not mean that these are the only versions that will work
       simply that they are confirmed to work better than other versions.

       Note that PHP versions between 3.0.11 and 3.0.16 are not recommended
       as several of these versions had serious problems (most notably 
       3.0.15 which broke the delete/undelete imap functions).  PHP 3.0.17 also
       has problems and is not recommended.  
       
       PHP 4 is now available and some of the version have had various issues
       with the IMAP support, at this time 4.0.3pl1 is known to work without
       any issues and 4.0.4 is know to have problems, 4.0.4pl1 is about to
       be released and should also be fine with TWIG.

-----------------------------------------------------------------------------
  
    Q: I've installed the advanced security option and the $disabled[] 
       options don't do anything, how can I disabled features?

    A: Once advanced security is enabled the $disabled[] options no longer
       function and you should use the administrative interface included in
       TWIG to enabled or disable access to various features. 

       However if you have not complied imap support in to php because you do
       not intend to grant access to mail you may run in to a problem where
       you cannot access the administrative feature of TWIG once you've
       used advanced.acl.population to build the initial acl database.

       This occurs because of a bug in php which causes php to crash if an
       imap function is called but imap functionality is not complied in to 
       php.  Since the main TWIG page by default displays your recent mail
       the main page will only display the top command bar and the rest
       will be blank, hence not allowing you to access the options list and
       the administrative link.

       To avoid this problem you need to remove the access rights to mail
       from the acl database, this is accomplished by executing the 
       following SQL command:

         	DELETE FROM twig_acls WHERE SID='2001';
        	DELETE FROM twig_acls WHERE SID='3000';
        	DELETE FROM twig_acls WHERE SID='3001';
        	DELETE FROM twig_acls WHERE SID='3002';

       The first command removes access rights to the mail feature, the same
       as setting $disabled["mail"] = 1, the rest remove individual mail 
       options.

       Once this is complete you can once more access the admin feature and
       set the various other modules through it.
       
-----------------------------------------------------------------------------
  
    Q: I'm using Debian and installed all the required software (including
       IMAP and MySQL in PHP) but still get function not found errors, why?

    A: The problem is that you need to add the following to the Dynamic
       Extensions section of /etc/php3/php3.ini:

	extension=imap.so
	extension=mysql.so

       You can clearly see this is the problem by looking at:

	http://<twig-url>/test.php3

       After all the tests it lists all the PHP3 info, including Extensions,
       without the extension lines in php3.ini it will be missing the IMAP
       and MySQL sections, afterwards it will have these sections.

-----------------------------------------------------------------------------
  
    Q: I'm running TWIG using Windows as my server and whenever someone 
       loads a message from the server PHP crashes and the page fails to 
       load, why?

    A: This is a problem with the IMAP dll sent in all distributions of PHP
       prior to 3.0.15.  Upgrade to PHP 3.0.16 to resolve this issue.

       If you cannot upgrade and have complied your copy of PHP for NT 
       yourself you can fix the problem by editing the imap dll code and 
       changing date[50] (on lines 1458 and 2330 of imap.c) to date[75].

-----------------------------------------------------------------------------
  
    Q: I'm using the news feature and would like to be able to read the
       articles in a threaded list is that possible?

    A: No, due to the limitations of being in a stateless environment TWIG
       does not support threaded news reading nor will it in the future.

-----------------------------------------------------------------------------
  
    Q: When I upload a file attachment I keep getting the following error:

	Max file size of 2097152 bytes exceeded - file [userfile] not saved
	in twig/index.php3 on line 1

       followed by a whole pile more errors about cookies, what's wrong?

    A: By default PHP limits the file size a user can upload so that a 
       user cannot fill the temp space, to increase the file size limit
       you need to edit your php3.ini (/usr/local/lib) to increase the value
       of the following line:

		upload_max_filesize = 2097152

-----------------------------------------------------------------------------
  
    Q: Some times my pages don't load or I can't see my mail box contents, it
       seems to happen to random users at random times, after investigating a
       bit I get the following log messages appearing from my IMAP server?:

	date time linux inetd[458]: imap/tcp server failing (looping), service
                                    terminated

	Why is this?
 
    A: This is a problem with inetd thinking that your imap server has a 
       problem or is under attack by a denial of service attack.  The solution
       is to tack a 'max connection' section onto the imap/inet definition:

	imap    stream  tcp     nowait.XXX  root    /usr/sbin/imapd	imapd

       It's in the man page for inetd, but the ".XXX" says that inetd should 
       allow a max of XXX connections per minute to imap before it sees it 
       as 'looping'.  You should set XXX to a value that handles your load
       but does not go far beyond it, this is usually determined 
       experimentally.

-----------------------------------------------------------------------------
  
    Q: In the mail feature I keep getting warnings like the following:

	Warning: Invalid content of \{\} in features/mail/mail.inc.php on line x

    A: This is caused by a bug in the regular expression library (or possible
       TWIG's use of it), it has been fixed in TWIG 2.3.0, however if you cannot
       immediately upgrade, editing the reported line number and adding a \ in 
       front of the curly brackets (you know { and }...) will solve the problem.

-----------------------------------------------------------------------------
  
    Q: I have php3 and TWIG 2.3.2 and in the news feature I keep getting 
       warnings like the following when I go to the news group management 
       screen:

	Parse error: under /feature/news/news.feature.php3 on line 20

    A: This release of TWIG had some php4 specific code added to 
       news.folders.inc.php3, to correct this problem you need to get the 2.3.1
       version of this file.  This problem was also fixed in 2.4.0 so upgrading
       will also solve the problem.

-----------------------------------------------------------------------------
  
    Q: I'm using Cyrus, Courier, MS Exchange or some other IMAP server than the
       University of Washington's (UofW), how do I get PHP's IMAP functions to
       compile with this server instead of UofW's?

    A: The UofW IMAP server actually has serveral components to it, including the
       IMAP server, a POP server and a set of client libraries.  The client 
       libraries (called c-client) are generic IMAP functions that will work with
       any IMAP server no just UofW's.  It is these libraries that you need to get
       PHP to compile with the IMAP functions.  

       You can still use the any IMAP server you want, but you will need to 
       download the UofW c-client code to compile PHP with.  You can find this 
       code on the UofW Web site (http://www.washington.edu/imap/).  There are
       several packages that contain the c-client code, these include the imap 
       server, pine and the acutall c-client package as well.

       Here are some instructions on how to compile PHP with this package, it
       assumes you have apache 1.3.12, php 1.3.12 and that you downloaded the 
       imap server package.  If this is not your case you can simply replace the
       appropriate versions and paths and it should work.

	1 - download files
		ftp://ftp.php3.com/pub/php-3.0.16.tar.gz
		ftp://ftp.apache.org/dist/apache-1.3.12.tar.gz
		ftp://ftp.cac.washington.edu/imap/imap-4.7.tar.Z

	1 - decompress the above:
		gzip -d php-3.0.16.tar.gz
		gzip -d apache-1.3.12.tar.gz
		gzip -d imap-4.7.tar.Z

	2 - untar the above
		tar -xvf php-3.0.16.tar
		tar -xvf apache-1.3.12.tar
		tar -xvf imap-4.7.tar

	3 - build IMAP
		change in to imap-4.7
		run make <system type>
		(where system type is slx for linux with shadow passwords)
		change in to c-client
		run ln -s /home/progs/imap-4.7/c-client lib
		run ln -s /home/progs/imap-4.7/c-client include
		(I'm not sure why the links are required but it's the only
		 way I've been able to get php to compile...)

	4 - configure apache
		change into ../apache-1.3.12
		run ./configure

	5 - configure and make php
		change into ../php-3.0.16
		run ./configure --with-apache=../apache_1.3.12
			        --enable-track-vars
				--with-imap=/home/progs/imap-4.7/c-client
				--with-mysql
		(note the full path in the --with-imap setting,
		 it is REQUIRED to be the full path)
		run make
		run make install

	6 - re-configure, build and install Apache
		change into ../apache-1.3.12
		run ./configure --activate-module=src/modules/php3/libphp3.a
		run make
		run make install

-----------------------------------------------------------------------------
  
    Q: I've got everything setup and running but whenever I try and send a 
       mail message/news article nothing happens (php segfaults and an empty
       page is displayed), what's wrong?

    A: Most likly your using PHP 3.0.17 which has a problem with accepting
       forms with file attachments in them (even if there is no file actually
       attached).  You have three choices:

	- downgrade to php 3.0.16
	- upgrade to php 3.0.18 
	- upgrade to php 4.0.3pl1

-----------------------------------------------------------------------------
  
    Q: I've got everything setup and running but whenever I try go to the 
       mail feature I get a blank window (php segfaults and an empty
       page is displayed) but all the other features seem fine, what's wrong?
       (Note that recent mail is displayed in the main feature still)

    A: Most likly your using PHP 4.0.4 which has a problem with it's sorting 
       routines.  You have two choices:

	- downgrade to php 4.0.3pl1
	- upgrade to php 4.0.4pl1 (should be out by the time you read this)

-----------------------------------------------------------------------------
  
    Q: I keep getting the following errors at the top of each page, what's 
       wrong:
       
       Warning: Cannot add header information - headers already sent by (output started at [somefile]) in [someotherfile] on line XX

    A: 	You have probably added an extra space outside of the <?php ?> tags
        in the config or header files when you edited them, make sure there
	are no extra spaces, blank lines or other characters in these files
	that are outside of the php tags or this kind of error will occur.

-----------------------------------------------------------------------------
  
    Q: I keep getting sent back to the main page whenever I try and send a
       mail message, what's wrong?

    A: If your using RedHat 7 and have installed the PHP 4.0.4pl1 rpm's
       then there is a problem with these RPM's, either downgrade to 4.0.3
       or install PHP from the PHP source tarball.
