Installing Supasite
Table of Contents
- Main
- Installation
- User's Guide
- Developer's Reference
Step 1: Check the Requirements
With the default configuration, Supasite interacts with a mySQL database to store news posts, manage multiple users, and configure parts of the site. The different site templates are stored in an XML file. Plans are underway to replace the database API and store everything in XML files... eventually transforming them into different format with XSLT. But I'm getting ahead of myself there. So for the initial release, you'll need this:
- A web server account running PHP4 with the ability to parse XML
- Access to a mySQL database
- An FTP client to upload the files
- A telnet client if the FTP client won't CHMOD files
- Some experience setting up PHP/CGI scripts is helpful, as is at least a moderate knowledge of HTML
Supasite has so far only been tested on a Linux Red Hat server running Apache (with eXpat for XML parsing), PHP4, and mySQL. If you try it on any other configurations, let me know how it goes.
Step 2: Upload the Files
When you upload the files, you can change the name of the supasite directory. Just remember to change the $supa['supa_path'] in the config.php file (see below).
Step 3: Edit the config.php file
If you go through [include_path]/config.php, you'll see a section that tells you which variables to edit. I'll explain those here:
- $supa["server_path"]
- This is the full server path to the web root directory. In the above example, it'd be '/home/jack.'
- $supa["web_path"]
- This is the web path to the site's root directory. If the site is the root on its domain, then it should be blank. Otherwise, it should have the full path in it. If the URL was 'http://www.jack.com/site,' then this variable would be '/site.'
- $supa["supa_path"]
- Remember above how I said the /supasite directory name was allowed to be changed? This is where you set it. By default, it's '/supasite.'
- $supa["domain"]
- This is the domain of the website, leaving the 'http://' out. For the above example, this would be 'www.jack.com.' It's main purpose is to provide a domain for setting a proper cookie.
- $supa["xmlrpc_authcode"]
- When you want your site to authenticate itself with a remote XML-RPC server, use this to set your code.
- $supa["include_path"]
- This is the path to the supasite include files. It is automatically configured by the script.
- $supa['db_type']
- This sets which database class is loaded. The only good value is 'mysql,' since that's the only class I've written so far.
- $supa['host']
- This is the address to the mySQL server. If it's on the same machine as the web server, then use the default value 'localhost.'
- $supa['user']
- This variable is the username used to log into the mySQL database
- $supa['pass']
- This is the password used to log into the mySQL database
- $supa['dbname']
- The name of the database the tables will be stored in.
- Compression?
- PHP can compress dynamic data and send it to a browser if it supports it. The ob_gzhandler is a function that handles all the work determining whether the browser can accept it or not. If it's supported, download speeds of the HTML will be greatly enhanced and your modem users will love you. Warning: This will not work on PHP versions less than 4.04. Comment this line out if you use an older version of PHP, or get your server admins to upgrade.
Step 4: Edit the web files
Next, you have to edit one line on the files that will be called by a browser. These files will have the same require_once line (require_once("***PUT YOUR SERVER PATH HERE***/config.php");) at the top:
- /[server_path]/news.php - the script that displays the news
- /[server_path]/install.php - script that sets up the database
- /[server_path]/search.php - script that handles all search engine queries
- /[server_path]/[supa_path]/index.php - the script that runs the supasite administration script
Basically, you just modify the require_once() line to point to your config.php. From there, the rest of the variables in the script will be set and you shouldn't get errors. Using our "jack.com example," it would look like: require_once("/home/jack/supasite/config.php");
Step 5: CHMOD files
This step assumes your server is running some form of Unix. By default, the files usually aren't writable by PHP (which writes the files under the username nobody). You have to give [include_path]/files full read/write permissions, including all the files inside. This will let Supasite modify, load, and save new templates. If you are using a Windows NT or 2000 server, just make sure PHP has Change access to that directory and its files. Please share your experiences with me on getting this to work.
On a Unix or Linux system, just go to the [include_path] directory ('/home/jack/supasite' from our "jack.com" example above) and type chmod 666 files. Then go inside the files directory and type chmod 666 *. Make sure you're in the correct directory, giving read/write access to the wrong stuff can be a security hazard. Also, make sure there are no important files in the 'files' directory (there isn't anything by default).
If you will be using the caching option, you will need a static HTML file in the root directory of your site that's writable. Usually this would be index.html, so just type chmod 666 index.html.
Step 6: Run install.php
Point your browser to install.php. (NOTE: your database must be created at this time) When it runs through the config.php for the first time, it will spit out some errors about the settings table not existing. This is normal, but shouldn't show up if your browser is CSS capable. The first time install.php runs, it will show a simple form asking for some more configuration settings. It's asking for your default values to populate the settings table in the database. Most of these settings are not mandatory, and can easily be changed at a later point.
Meta Info
- Site Title
- The title of your site.
- Site Description
- A quick description of what your site is about.
- Keywords
- Keywords used to find your site through a search engine.
- Main Webmaster
- Name of the main webmaster of the site.
- Main Webmaster's email
- His/her email address.
Site Config
- Authorization Type
- This authorization files handle how the administration script authorizes users. The only option available right now is 'cookies.' The file auth_cookies.php will compare their username/password against the mySQL database, and create a cookie upon a successful operation. In the future, one could write a quick script that would use HTTP basic authentication instead, for example.
- News Age
- Simply, this is the number of posts to display per page.
- Date String
- String used to convert the date to a readable format. This goes into mySQL's DATE_FORMAT() function to print the date above each news post.
- Time String
- String used to convert the time to a readable format. This goes into mySQL's DATE_FORMAT() function to print the time above each news post.
- Allowable HTML Tags
- List of allowable HTML tags that can be entered in the Comments.
News Topic Config
- Topic Name
- This will be the default topic when posting news. If you don't wish to use topics, leave it at the default.
User Config
- Super User username/pass
-
- To log in for the first time, you need to create your 'root' account with full access.
Finishing Up...
Delete install.php, and any upgx.xx-x.xx.php files. If all goes well, your site should now be ready to rock. Right now, the site is using my supasite template, but I only included that as an example of what you can do with templates. From here, you can either begin making your own template or loading a saved template if you happen to have one. Good luck on your new site...