phpNuke - A Portal Beginning


Table of Contents:


Introduction

Been looking for that piece of software to turn your website into a dynamic environment? Want to give your website users the opportunity to participate in a friendly to use community? Want forums, news articles ?

What you are looking for is some form of web portal system. The current buzzword is Content Management System (CMS.)

A very popular portal (CMS) system is phpNuke and the derivative works myphpnuke and postNuke. In fact, on the postNuke site you will find a lot of references to other similar systems.

These notes show specific intructions for installing the 4.x revisions of phpNuke. The basic information is the same for revision 5. For more information refer to the respective web sites http://www.phpnuke.org, http://www.myphpnuke.com and http://www.postnuke.com

If you have the time to learn to configure and install MySQL, PHP4 then you are already half way ready to install a great database driven web site.

I 1st came across phpnuke while I was scrounging for a database driven portal manager for a high school I was working with and these notes (extending on the clear installation documentation already provided with the package) was a need by myself to detail some of the work that I went through to get the system up and running. Of course the hope is that it will make it easier to install on other sites.

One seriously major attraction for me, the ability to run phpNuke on my MSWindowsX/PWS5 laptop before I push it onto the OpenBSD/Apache/OpenSSL Server. This way I can test some of the things I want to do at the school (user-site) before I actually do it. Of course once I get the OpenBSD laptop going then I wont need to worry about WinX ?

This installation uses Apache, MySQL and PHP 4 as the web, database, scripting Engine servers. Although this discussion is primarily for OpenBSD, I have had this installation successfully work on MSWindows (although the encryption code in nuke doesn't work.) phpNuke is primarily developed (and working) in Linux.

Getting the Files

[ref: PHP-Nuke-5.0.tar.gz or PHP-Nuke-4.4.1a.tar.gz]

The 1st thing to do is to download the source files for phpNuke from the http://www.phpnuke.org website.

At the writing of this guide, there were two releases with a very recent release of the 5.0 stream of phpnuke. As I have no lengthy experience, I can only recommend working with 5.0 as that is where development seems to be continuing.

Installation

[ref: PHP-Nuke-X.Y.Z.tar.gz]

After you have downloaded the files, untar the file on your local drive and review two important files, INSTALL and README.

~$ tar -zxvf PHP-Nuke-X.Y.Z.tar.gz

~$ cd PHP-Nuke-X.Y.Z

PHP-Nuke-X.Y.Z$ ls

Basic installation instructions are incorporated in the INSTALL text file.

The tar file extracts two sub-directories from its root; html/ contains the php files that you will be using, and sql/ which contains the script instructions for configuring your MySQL database.

Moving the files to their home

[ref: ./html, ./sql, ~/public_html or /var/www/htdocs]

Copy (or move) the files in the html/ directory to your home directory (eg. /var/www/htdocs or ~/public_html)

PHP-Nuke-X.Y.Z$ cd html

html$ mv * ~/public_html

Refer to the notes on Apache if you have any difficulties with this section. I would put the files into something like /var/www/nuke and modify Apache to point to this as the home directory. This way, I can keep the wonderful manuals in /var/www/htdocs for Apache, and mod_ssl.

Configuring the MySQL Database

[ref: phpnuke_mysql_create.sql, sql/nuke.sql]

We will configure the MySQL Database in two stages. In the 1st stage we will configure the database to be used and the user through whom we will use. In the 2nd stage we will configure the tables in the database, and populate the table with some initial data.

# phpnuke_mysql_create.sql
#
# You can simply direct this file to mysql at STDIN:
# mysql --user username --password --host host < nuke_NOMOA.sql
# . username will need to have privileges to create a database and change mysql
# . root access is the simplest if you run your own server, otherwise you can modify
# . this script as you need and ask the ISP/Site Manager to configure your database
# . for you.
#============================================================================
# YOU WILL WANT TO CHANGE -
#
# NOMOAuser  -to- the username you wish to use (occurs TWICE) [16 character field]
# nukeNOMOA  -to- the database name you wish to use. (occurs TWICE) [64 character field]
# NOpassword -to- the Password you wish to encrypt (occurs ONCE)[16 character field]
#============================================================================

 

CONNECT mysql;

 

INSERT INTO user ( host, user, password )
  VALUES (
    'localhost',
    'NOMOAuser',
    password('NOpassword')
  );

 

INSERT INTO db (
    host, db, user,
    Select_priv, Insert_priv, Update_priv, Delete_priv,
    Create_priv, Drop_priv )
  VALUES (
    'localhost',
    'nukeNOMOA',
    'NOMOAuser',
    'Y', 'Y', 'Y', 'Y',
    'Y', 'Y'
  );

 

CREATE DATABASE nukeNOMOA;

FLUSH PRIVILEGES;

 

# done!

Figure 1 - MySQL script to create the user account, access privileges, and database

1st Stage - Create the Database.

Use the above script to configure the user account, access privileges, and create the new database to be used. If you have a shell connection to your OpenBSD server, while this page is on the screen, then you can start mysql and paste the above script onto the terminal session.

Otherwise, save the content into a text file, such as phpnuke_mysql_create.sql

$ mysql -u privilegeduser -p < phpnuke_mysql_create.sql

Password: ******** (password prompt)

After the creation of the Database, and the user to make modifications to your database then the creation of the database tables differs between phpnuke 4.x and phpnuke5.x/postnuke. In postnuke/myphnuke you can now continue with the installation instructions provided by those applications (provided scripts will create the tables.)

Security Note:

When the phpNuke server is initially launched, it will use a Super User access code of user-id: God, Password: password. It is very important that the first thing you do is change this.

An alternative, if you really do not want to even start the server with the default password is to modify the sql/nuke.sql in the following manner.

Edit sql/nuke.sql which has the following line: (line 37 in my 5.0 release)

INSERT INTO nuke_authors VALUES ('God','God','http://phpnuke.org','http://phpnuke.org','Password',1,0,0,0,0,0,0,0,0,0,0,0,1);

to read

INSERT INTO nuke_authors (

    aid,
    name,
    url,
    email,
    pwd,
    counter, radminarticle, radmintopic, radminuser, radminsurvey,     radminsection, radminlink, radminephem, radminfilem, radminfaq,
    radmindownload, radminreviews, radminsuper'

  )

  VALUES (

    'MyAdminID',

    'God',

    'http://my-site-details',

    'some-email@my-site-details',

    'MyAdminPassword',

    1,0,0,0,0,0,0,0,0,0,0,0,1

);

The field names are included in the above INSERT statement for documentation, (colored blue) you can leave it out if you are trying to type the script manually.

 

The Security related changes to the script are highlighted in BLUE

The major concern here is that the password is stored in clear-text on Windows machines, I'll have to check on the OpenBSD box.

2nd Stage - Create and Fill the Tables.

Use the sql script supplied with phpnuke to create the database tables and populate the table with initial data. You can change the table contents within the administration module.

$ cd ~/PHP-NUKE-X.Y.Z/sql

$ ls

nuke.sql

 

$ mysql -u privilegeduser -p nukeNOMOA < nuke.sql

Password: ******** (password prompt)

Please take note that "nukeNOMOA" mentioned here is the database name you specified above in the script file 'phpnuke_mysql_create.sql' I am using a different database name just in case you are not able to use the default name 'nuke' because more than one person on your system is using phpNuke.

Configuring for Start-Up

[ref: config.php]

In this part of the configuration, we will configure phpNuke so we can start-up the web based administration system.

Edit the file config.php and make the following changes:

$dbhost  = "localhost";
$dbuname = "NOMOAuser";
$dbpass  = "NOpassword";
$dbname  = "nukeNOMOA";
$system  = 0; //1 for MS Windows, 0 for Unix

Be sure to change the above user-name, database-password, and database-name to those which you defined earlier, and will be using.

Save the file.

The final console activity is to set the user-id, group-id and modes for the files.

Graphical Administration

You should now be able to start up your Nuke'd website by launching the browser and pointing to http://your-site-details/ or something like http://your-site-details/nuke

If you are having problems, refer to the notes on configuring your Apache server.

To begin administration, changes (as prescribed by the INSTALL documentation,) start-up your favourite browser to http://your-site-details/admin.php. When the page is started you should be require to login

Administration System Login

Admin ID
Password

When you have successfully logged in as Administrator, then you should get the following display of Administration commands.

Administration Menu   Banners Administration
[ Online Manual ]
Add Story Blocks Download Edit Users Ephemerids FAQ
File Manager Messages Edit Admins HTTP Referers Preferences Reviews
Sections Manager Surveys/Polls Topics Manager Web Links Logout / Exit

The following is a squence of minimal modifications I go through to customise my installation. I will leave the graphics and theme modifications for other sites more suited to that stuff.

Set, Change your Admin Password

[Edit Admins] Use the Edit Admins Section to Modify your Admin password. We also change the Admin name from "God" to something else because the 1st installation we put this on was a private school from one of our churches here.

This is obviously where you will come at a later stage to add / remove administrators for your successful site.

Add an unprivileged User

[Edit Users] It's always good to differentiate between what are administrative tasks and personal tasks, so create for yourself an unprivileged user account for submitting messages and things that do not really need to be done by the administrator account.

Set, Configure the General Features for Your Site

[Preferences]. Change the general settings for your site in Preferences.

The most basic information you can change here are: (check list)

[] Site Name
[] Site URL
[] Site Logo
[] Site Slogan
etc.

The items which we make changes and you may really need to consider are:-
[] Activate Ultramode (say NO until you figure this out)
[] Allow Anonymous Post (say NO if the experience of others is an example)
[] Default Theme (This is where you can play with your themes)
[] Locale Time Format (en_us, I haven't found out where this setting is from)
[] Let Anonymous users to post new links? (NO if you want some management of your links)

[] Mail New Stories to Admin (in our case "YES")

[] Comments Moderation ==> Moderation by Admin
[] Minimum User Password ==> We require a minimum length '8', try to force it so it isn't commonly used on other sites. We also generate pass phrases for our internal users (and try to synch them with the other server services we use.)

Modify BLOCKS to display

[Blocks] The Blocks section control a significant part of the layout of your website and these are things we had to seriously consider, or change within the Blocks section.

Languages: DEACTIVATE. We deactivated this because we were only dealing in English and Tongan (which we had not created a language file for.) More importantly, the language 'flags' were causing a display problem for us. Obviously this depends on your priority.

Main Menu: EDIT and MAKE CHANGES

In our configuration we needed to start without some of the basic features of the portal, this required editing the Main Menu not to display:
..:: Downloads ::.. most of my 1st start projects do not have any download files
..:: Members List ::.. most of my 1st start projects will not want to advertise users immediately
..:: Recommend Us ::.. put on hold until things are more reasonable ?


Administration: ACTIVATE this menu so it is easier to know when we're logged in as Administrator instead of as a regular user. Administrator menus allow us to quickly pounce into Administrator features without having to manually enter the URL address.

We also provide a link here to sections on our Internal Web Services for Administration purposes. For example, we have a web area for configuring our Squid Caching Server.


Random Headlines: DEACTIVATE, we haven't connected well enough yet. Once we can get some of the other schools to publish notes online we can probably share information through this mechanism.

On a BSD portal you would probably link this section to some of the other sites like DaemonNews.org (my favourite haunt) or OpenBSD Journal .

First Block Left: EDIT and MAKE CHANGES.
On one site we are using this as a special menu for tutorials that we have available internally. Since we are limiting access to the LAN (and local bandwidth users) this gives us a good categorisation area.

First Block Right: EDIT and MAKE CHANGES.
On the same site as above we are using this to reference locally mirrored materials. Again, due to our bandwidth limitations we are blocking access to these areas from the Internet.

Information Block: EDIT and MAKE CHANGES.

I'm sure I can think up of something to go in here ?

Modify TOPICS

Topics, as I can understand it, is good for categorising dicussion areas. The Topics section then holds the archives of discussions/ articles published on the site.

The sample topics are very Geekish, so I suggest that the 1st thing you do with topics is delete them all. (For the non-geek sites)

Modify HTTP-Referers

The material here are examples, and I think should be deleted until you figure out what it is used for.

Modify WEB-Links

Likewise, this section holds sample material.

I do think that it would be great to set our favourite sites here (like phpnuke.org and nomoa.com/bsd ?)

META Tags

Now, here is where some people do not do enough modifications.

PHPnuke comes with a default META section for describing your site contents. You really need to change this to be accurate.

Edit the file header.php (look around line 49 for the META setting KEYWORDS)

echo "<META NAME=\"KEYWORDS\" CONTENT=\"News, news, New, New, Technology, technology, Headlines, headlines, Nuke, nuke, PHP-Nuke, phpnuke, php-nuke, Geek, geek, Geeks, geeks, Hacker, hacker, Hackers, hackers, Linux, linux, Windows, windows, Software, software, Download, download, Downloads, downloads, Free, FREE, free, Community, community, MP3, mp3, Forum, forum, Forums, forums, Bulletin, bulletin, Board, board, Boards, boards, PHP, php, Survey, survey, Kernel, kernel, Comment, comment, Comments, comments, Portal, portal, ODP, odp, Open, open, Open Source, OpenSource, Opensource, opensource, open source, Free Software, FreeSoftware, Freesoftware, free software, GNU, gnu, GPL, gpl, License, license, Unix, UNIX, *nix, unix, MySQL, mysql, SQL, sql, Database, DataBase, database, Mandrake, mandrake, Red Hat, RedHat, red hat, Slackware, slackware, SUSE, SuSE, suse, Debian, debian, Gnome, GNOME, gnome, Kde, KDE, kde, Enlightenment, enlightenment, Intercative, interactive, Programming, programming, Extreme, extreme, Game, game, Games, games, Web Site, web site, Weblog, WebLog, weblog, Guru, GURU, guru\">\n";

To Read Something Like This

echo "<META NAME=\"KEYWORDS\" CONTENT=\"THIS IS MY STUFF\">\n";

The above php code just wraps the html tags <meta name="KEYWORDS" content="stuff-here"> Be careful with this modification as it may break the code. Make sure you leave the \" ... \" (escaped quotes) untouched. Your modifications should only be within the escaped quotes.

Author and Copyright

Copyright (c) 2000/1/2 Samiuela LV Taufa. All Rights Reserved.

I reserve the right to be totally incorrect even at the best advice of betters. In other words, I'm probably wrong in enough places for you to call me an idiot, but don't 'cause you'll hurt my sensibilities, just tell me where I went wrong and I'll try again.

You are permitted and encouraged to use this guide for fun or for profit as you see fit. If you republish this work in what-ever form, it would be nice (though not enforceable) to be credited.

phpNuke, a Portal Beginning

Copyright  © 2000/1/2 NoMoa Publishers All rights reserved. Caveat Emptor