Shared Server Installation with FrontPage Extensions


by Peter J. Patsula (smallbizportal.net)

The following installation procedures are to help those who wish to install PHPreactor on a shared server i.e., a web host provider using a Linux or Unix server and FrontPage Extensions.

Why PHPreactor?

The phpreactor team is dedicated to speed and usability of their systems for USERS. However, developers and installers need to be computer savvy. So far phpreactor is free, like php and Linux itself. In a sense, the new php developers are saying, some kinds of system software are like “language” and should not be controlled by one giant conglomerate (i.e., Microsoft). It should be noted that many of the features that make a system easy to install, also slow down the server, especially for large communities. PHPreactor is not the easiest installation for users who don’t have their own server and are using a host provider, but it is worth it.

Why PHP and not ASP?

PHP is FREE unlike most of Microsoft’s products. PHP is similar to CGI and therefore has a huge base of potential developers. More and more competitors of Microsoft including the likes of IBM are serious about Linux based systems as a competitive operating system to Windows. PHP should have a bright future.

INSTALL

Get ready to roll up your sleeves:

  1. Make sure php 4 is installed on your host server. Although, other installations have worked with php 3, you will have to make a bunch of additional changes (search http://phpreactor.org/forums/ for info). If you are serious about phpreactor then don’t waste your time with php 3. The phpreactor team, as with other php developers, have adopted php 4 with great enthusiasm (it is simply that much better).

  2. Use Winzip to unzip phpreactor and store it in a directory on your hard drive.

  3. Now comes the fun part. You need a program like Dreamweaver or CuteFTP to SEARCH every file in your phpreactor distribution and replace include("inc/global.inc.php") with include("/path/to/homedir/inc/global.inc.php"). Your include path may be something like /usr/home/youraccount/inc/global.inc.php. Since many web host providers don’t like you making directories in your root you may need to ask them to create a /data/ directory for you in your root. Your path then might be something like /usr/home/youraccount/data/inc/global.inc.php. 

  4. You also have to update the path to conf/global.conf.php in global.inc.php as well as update the paths to your password and groups files in all .htaccess files (if you are using FrontPage extensions you don’t need the .htaccess files, except the one in htdocs/. You will have to use FrontPage to password protect important admin files in htdocs.

  5. Make sure you also update the $reactorcore variable in /conf/global.conf.php to the URL of the directory where htdocs is located.  This must be a valid URL, accessible by the webserver e.g., http://www.yourdomain.com. You can install them in a subdirectory if you like http://www.yourdomain.com/myphpreactor/. However, if you do so, you will have to make a more changes. Phpreactor was not originally designed for this so its installation becomes more complicated the more changes you make.

  6. Open /conf/global.conf.php and update the configuration settings.  Open /conf/users.conf.php and change the $userdb_private_key and $bbs_private_key variables.  You can change the $bbs_private_key as often as you like, but you can NEVER change $userdb_private_key after you install your user's table.  So pick a good key and write it down.

  7. Update the rest of your language and other settings variables in the files located in /conf/. You will have to read through quite a few files. Make sure you start to get a good idea of the settings and variables. Phpreactor does not have all the config variables in one file. They are scattered in the config files directly related to the boards being installed. This has its advantages and disadvantages. The advantage is easier addition of new modules. The disadvantage is that you as a developer/installer have to have a pretty good grasp of phpreactor.

  8. Create a database for your system (if one does not already exist). Your host provider may or may not allow you to do this. Usually, you will have to upgrade your account to include MySLQ database access. Update the database host, name, username, and passwords in /inc/db.inc.php (for the function db1_query()) Leave the db2_query() untouched unless you know what it's for). If you already have a database installed and other forums or tables, be careful that you do not have a table like “users” or “forum” otherwise your reactor won’t work properly.
  9. Upload your phpreactor to your host provider. Make sure that you place the files under /htdocs/ under your document root e.g., /usr/home/youraccount/htdocs/. All other files must go under your account root e.g., /usr/home/youraccount/data/. This is for security reasons.
  10. Call the page /htdocs/admin/ in your browser.  You should get a message that the users table has not been installed. If you are integrating with an existing users database, make the appropriate changes to /inc/users.inc.php. If you are starting a new database, click "install users".

  11. After successfully creating the users table, you should see a page with links to all admin functions. The user administration functions are located at the top of this page. Make a new user for yourself.  Choose a good password. Give this user administration privileges. You may want to reserve some other usernames at this point as well. You should all check to make sure all think links are working properly. You may have to go back into the code and make a few changes, especially if you have done something like change your /htdocs/forums/ to something like /htdocs/myforums/ (remember: the more changes you make the trickier your installation).

  12. You are now ready to install the boards. Install only the boards you want, delete the boards you don't want from your document root (/htdocs/). However, be warned that you may across many access errors. PHPreactor still has a bunch of includes that need to be updated. These include access to image files (e.g., in the cards.php) and other php files. This is especially true if you install phpreactor under a subdirectory like /htdocs/myphpreactor/. There is no way to list all these files. You should be able to find all these files by calling up each of the .php files from your browser, noting the errors and changing them in the appropriate file. As phpreactor matures, these errors will disappear and the installation will be easier, but until then you will have to manually update these files.

  13.  Click on forums to install the forums board.  If you are not doing a custom install, click "install", then add some test forums.  Open the forums board at /htdocs/forums/ to test them.

  14. Click on chat events to install the chat events board. If you are not doing a custom install, click "install", then add some test events.  Open the chat board at /htdocs/chat/ to test them.

  15. Click on polls to install the polls board. If you are not doing a custom install, click "install", then add some test polls.  Open the polls board at /htdocs/polls/ to test them.

  16. Click on cards to install the cards board. If you are not doing a custom  install, click "install", then add some test cards.  Open the cards board at /htdocs/cards/ to test them.

  17. Click on articles to install the articles board. If you are not doing a custom install, click "install", then add some test articles.  Open the articles board at /htdocs/articles/ to test them.

  18. Click on cms to install the cms board. If you are not doing a custom install, click "install", then add some test pages.  Open the cms board at /htdocs/cms/ to test them.

  19. Now it’s time to customize the templates located in /templates/ and add some spice. Start with the templates included in the distribution. Check out http://phpreactor.org for bug reports and updates.

Frequently Asked Questions


FAQ 1: What do the following errors mean?

Fatal error:

Fatal error: Unable to open /usr/home/youraccount/htdocs/yourphpreactor/articles/print.php/1 in Unknown on line 0

This usually means that one of your includes is not set up properly.

mysql error # 1146: (concealed)

Uncomment the #error message in the db.inc.php file (around line 90). Now when you request the file from your browser you should be able to find which file is not loading properly.

Fatal error: Call to undefined function:

Fatal error: Call to undefined function: cards_query() in /usr/home/patsula.com/htdocs/smallbizportal/modules/randomcards.module.php4 on line 56

Fatal error: Call to undefined function: stylepicker() in /usr/home/patsula.com/htdocs/smallbizportal/templates/int.tpl.php4 on line 6

Fatal error: Call to undefined function: jpopclick() in /usr/home/patsula.com/htdocs/smallbizportal/modules/chat_in_forum.module.php4 on line 64

The above following errors usually mean that  one of your global includes is missing therefore a function is not being defined and cannot be properly called. Find out which global is missing and include it or make sure that file that has this include is loading properly.

if(!defined("REACTOR_INC_GLOBAL")) { include("$pathtohomedir."/inc/global.inc.php"); }

FAQ 2: What do the numbers for the $timeadj setting mean?

The $timeadj setting is located in the global.conf.php file.

60*60*0 is seconds*minutes*hours

FAQ 3: How do I set up cronjobs?

Cronjobs are used to run a database backup, the card mailer.php (this "sends cards at a later date), and the forum boards bbsmail.php at different times during the day. The problem is most shared host providers won’t give you access to you crontab file or will only run a cronjob once every 24 hours to reduce server load. You can use a fakecron cgi script which can run files for you but these don’t work too well, especially for the bbsmail.php.

If you can only run your cronjob once a day, disable $allowemailreplies in your bbs.conf.php. You could set it to run every 24 hours but if your community gets big your host server may not be able to handle it. Some host servers stop running scripts after 60 seconds so you may only get out a few replies anyway. If you really need this function, you must find a host which allows you to create your own crontask (they are out there).

FAQ 3: What is the $interval = 1800 setting in BBSmail.php?

$interval = 1800; //make sure this corresponds exactly with the interval of your cron jobs

$lastupdate = time() - $interval;

$errormessage = "cron job not working";

1800 refers to 1800 seconds. bbsmail.php will examine your database for all files made in the last 30 minutes and then mail out those that selected the reply. Your cronjobs must be running the file every 30 minutes. If it is not doing this then either your users will miss a reply or will get two replies, or worse yet replies every 30 minutes.

FAQ 4: How do I install a new board?

Simply copy the entire htdocs/forums/ directory to a directory e.g., htdocs/classifieds/. That’s it!

FAQ 5: What is does the “status” entry box mean?

This is used to turn forums as well as cards and articles on or off.

status 1 or 0 1 = on and 0 = off

FAQ 6: What are pfid & rfid i.e., How do I set up forums?

fid = forum id (in database)

pfid = parent forum id

rfid = root forum id

Every time you create a new forum, phpreactor automatically gives it an fid (i.e., forum id). You can’t change this. However, you can change the pfid and rfid. Basically these numbers give you a variety of ways to set up your forums. The best way to test this feature out is to create a couple of forums and then play around with the pfid’s and rfid’s in your admin. If you change a number your phpreactor won’t self-destruct so be brave, but it will change how the forums are displayed and categorized. This feature is pretty cool once you get past the non-user-friendly pfid and rfid terms. 

To make your forums work like phpreactor’s set up the boards as follows:

Board 1

fid=1

pfid =1

rfid=1

Board 2

fid=2

pfid=2

rfid=3

FAQ 7: What is .htpasswd?

If you are protecting your htdocs/ directories with .htaccess, you will need to set up a password file, named .htpasswd. It should be located in a directory called htpass e.g., /usrs/home/youraccount/data/htpass/.htpasswd. Your .htpasswd is the file used to keep your web access passwords.

FAQ 8: How do I set up my .htaccess file?

A sample .htaccess file might look like this:

AuthUserFile /usrs/home/youraccount/htpass/.htpasswd

AuthGroupFile /dev/null

AuthName X_Files_Area

AuthType Basic

require user jack bean

The file above, when placed in your htdocs/directory, restricts access to your phpreactor to web viewers who authenticate with usernames jack or bean and their respective passwords as defined in your .htpasswd file. In this case, it is located at ~/htpass/.htpasswd .

FAQ 9: How do I configure the 'last seen' box and other modules?

The last seen box is a module. You can see it in the modules directory. To include it in a script, just include the file:

Note: You will have to make sure that the calling script has the include dependencies in order. (i.e. the script it is included in must have already included, global.inc, db.inc, lang.inc, and users.inc).

You MUST include the dependencies of the module in the calling script, and not in the module itself.

We do it this way because the module may be included within a function, and any variables within the include file it calls may not have global scope.

So for example, if you want to use lastarticles.module.php in forums/, you must add:

//INCLUDE ARTICLES FUNCTIONS

if(!defined("REACTOR_INC_ARTICLES")) { include($pathtohomedir."/inc/articles.inc.php"); }

to htdocs/forums/browse.php

Here is an example of how to insert some of the modules in your forums/browse.php

function tpl_sidebar() {  

global $pathtohomedir,$boardname,$artid;

include($pathtohomedir."/modules/lastarticles.module.php"); 

?>

<br>

<?php

include($pathtohomedir."/modules/lastposts.module.php");

?>

<br>

<?php

if($boardname!="forums")

include($pathtohomedir."/modules/lastseen.module.php"); }

This is definitely not any easy way to configure the reactor, but users should know what they are doing before that add modules which increase server load significantly.

On an optimized server, the solution is to include code explicitly or build one gigantic include file.

Don’t forget to check your lastseen.module.php to make sure the board name is set up properly.