/*
    Pagetool
    Copyright 2001,2002 Pagetool Development Team
    pagetool-user@lists.sourceforge.net http://www.pagetool.org/
    $Id: README_CGI.txt,v 1.1 2004/03/28 22:59:26 daveguerin Exp $
*/

Pagetool 1.xx

README_CGI

For the most recent information about this version of Pagetool (including the 
install instructions, readme, to do, etc.) go to:

http://www.pagetool.org


1. PREREQUISITES

Before you begin, you need to have a web server or a shared "virtual hosting" 
account on a web server that has at least the following installed and running:

- the PHP4 web scripting language (version 4.00 or higher) installed as a 
module. Pagetool won't work "out of the box" with the CGI version because of the
authentication used. But all is not lost, it is possible to use Pagetool with 
PHP in cgi mode, please see README_CGI.txt for more details. Which is this file!
So read on to find out how to get Pagetool working on your GCI PHP system. 

- a version of the MYSQL database server that works with PHP4
 
- the Apache web server (it may be possible to run Pagetool on an IIS/ISAPI system, 
but we have not tested it yet)

If you are using Pagetool on a shared server, be sure to read the SECURITY.txt 
document to make sure that you do not inadvertently give access to your Pagetool 
passwords or scripts to other accounts on that shared server.

2. STEP-BY-STEP Setup Instructions

a.  Download the Pagetool Software

b.  Unpack the file, either before or after moving it to the home directory of 
your shared hosting account (whichever is easier for you).  The Linux commands 
to unpack the downloaded file are: gunzip <pagetoolfile> tar -xf <unzipped 
pagetool file>

The result of unpacking will be a directory called pagetool-1.xx that will 
contain everything. xx will be the current version number.

c.  Move all the pagetool files and directories to the directory that houses 
your web site.  (Be sure to scan the list first so that you do not overwrite 
files in your web folder that have identical names.)

Again, in Linux, this might look like: mv pagetool/* www    (or) mv pagetool/* 
/web

Pagetool can be installed in a subfolder of your www folder.  

d.  Next create your database. If you are using an ISP, you may need to ask the 
support department to help you if there is not an option for this on your 
website control panel.  For the next step, you will need to know the database 
name and at least one username/password combo with full access to the data 
(including drop, create, and alter table privileges).

If you are creating the database yourself you will want to first create the 
database:

$ mysqladmin -u root -p create <database-name>

Then run MYSQL as root:

$ mysql -u root -p mysql

To verify your database exists, you can type to mysql:

mysql> show databases

and a list including the database you just created should appear.

Finally, from the mysql> prompt, insert a new user. Admin is a suggestion, but 
you can use any user name that you like.  If your website resides on the same 
server as your database, then leave "localhost" as is.  However, if your web 
site is on a different server, then replace "localhost" with your web domain 
(i.e. www.mydomain.org). The following should be entered as one MYSQL command 
(it's OK to press enter between the lines; MYSQL knows you are done when it sees 
the semicolon at the end):

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON <database-name>.* TO 
admin@localhost IDENTIFIED BY 'make-up-a-password-here';



e.  Once you have successfully created a database, write down the database name, 
user name and password and then run the Pagetool Installer.  This installer can 
be launched from the web by pointing your browser to "src/setup" within the web 
folder where pagetool resides:

http://www.mydomain.org/src/setup/


As this is the CGI install let's first of all check that you are in CGI mode! 
Click on that link to phpinfo.php. In the top block of data shown it will say 
Server API and then CGI. If it says Apache as the Server API then you should be 
reading the README.txt file, unless you really want to use cookie 
authentication for some reason.

OK, still here, so you do have a  CGI install to content with. So, next follow 
the instructions on the screen, clicking Step 1 and then creating your 
pt_config.inc, index.php and test.php files.

Next you need to edit your newly created pt_config.inc file. Down in the custom
settings section of the file there are the following lines:



// ############ Custom settings ###########################

/* If you followed the install instructions exactly, then you should not
need to modify anything else in this file. */

/* Set authentication to either cookies or http. */
$ptconf['auth'] = 'cookies';

/* If you use cookies for authentication, please change the following value to any random set of 
letters and numbers. To ensure security it is important that you do not use this default random
value. */
$ptconf['hash_var'] = 'jkljkl;32$%^fwvjfklsa;jk';



Because we need cookie authentication we ARE going to modify some values in the
file. Change the $ptconf['auth'] line to read:


$ptconf['auth'] = 'cookies';


And then change the value of $ptconf['hash_var'] to something other than the 
value there. It doesn't matter what value you give, just as long as it IS 
different to the value already there.

We're done with pt_config.inc, so save it back to your web server.


Next we are going to create the tables manually, and then populate them with the
default data. You can do this using phpMyAdmin, or directly from the command 
line. The files you need are

src/setup/sql/tables-sql.txt

for the tables, and

src/setup/sql/data-sql.txt

for the data.


If you are successful you should now be able to view the default pages called 
homepage and test. Yes? Great. Nearly done.

If you look at the pt_core_users table, using phpMyAdmin or similar, you'll see 
that there is one user called admin and the passwd field has a value of 
password. Pagetool stores password in the database in an encrypted form, so we 
need to change that passwd value to:

59cdWFMTnm6KU

If you're using phpMyAdmin then I'd suggest a cut and paste there, to avoid miss
typing :-) If you're using the command line then the SQL is:

UPDATE pt_core_users SET passwd='59cdWFMTnm6KU' WHERE user_id='1';

You should now be able to log into Pagetool by following the link on the home 
page. The username to use is admin and the password is pagetool. I'd suggest 
changing that password as soon as you have got a login! Click on the Password 
link in the admin interface to do this.

A bit more long winded than the normal install, well done if you got it to work.

Enjoy! :-)

If you have problems then ask on the pagetool-user email list. See:

http://lists.sourceforge.net/lists/listinfo/pagetool-user

Searching the list archives first might be an idea :-) See:

http://sourceforge.net/mailarchive/forum.php?forum_id=7949
