3.2. Installation process

3.2.1. Download

Well... there is little to say here, it suffices to go to a site that holds the files and download them. There is only a small remark to make: if you use Windows and download a version comprised of a file with the ending tar.gz, do not worry, your Winzip supports it without problems. Once downloaded, extract it and “throw” all its contents in a folder you created for this purpose and you call “Nuke6” or whatever ( sites from which you can download PHP-Nuke are: phpnuke.org, www.spaghettibrain.com etc.).

3.2.2. Upload through FTP

Well, now what remains is just to upload the files to the interior of our main server directory that resides on our provider.

CautionAttention!
 

It is highly recommended, prior to any installation steps, to verify that your provider supports PHP and MySQL.

Your ISP has already given you:

For FTP in the Windows plattform, we recommend using the WS_FTP application. It is free for personal use and you can download it from download.com by entering the search key “ws_ftp”. For the Linux plattform instead, we recommend GFTP (free for all and preinstalled in all distributions), which can be run from the command line by simply typing “gftp”.

Figure 3-1. WS_FTP: General connection parameters.

WS_FTP: General connection parameters.

The use of an FTP program is very simple - we will follow the procedure through 4 screens that enable us to:

Figure 3-1 shows the WS_FTP General Connection Parameters screen. Entering the right values in the fields of that screen will enable you to conncet to the server where you want to upload the files.

CautionAttention!
 

If you are installing PHP-Nuke locally, it is not necessary to use FTP! In this case, it suffices to copy the files into the right directory. In case you are working under Linux, it may be necessary to set the right file permissions. See Section 3.2.3 on how to do this.

Figure 3-2. WS_FTP: Main screen with local and remote windows.

WS_FTP: Main screen with local and remote windows.

Once connected, the next operation is to upload the files on the remote server. With WS_FTP, as well as woth the majority of the other FTP clients, the window that contains the local files is located to the left, while the remote files are displayed in a window to the right (Figure 3-2). You have to position your cursor on the directory that contains the files to be uploaded to the left and the directory tha has to receive them on the remote host to the right. You can do this through the graphical interface of WS_FTP.

As you can see in Figure 3-2, there are also some function buttons there: the two arrows are used to upload / download files to / from the server, the other two buttons that are functionally important are “MkDir”, which creates a new directory, and “Refresh”, which updates the view of data contained in a window.

Don't upload all extracted files. After extraction, you will find a structure similar to the one depicted in Figure 3-3.

Figure 3-3. PHP-Nuke 6.0 file structure

PHP-Nuke 6.0 file structure

You don't need to upload all the files from the folder, in the main directory of your web presence you will only need to upload the contents of the html folder (so just do a doubleclick on the html folder and upload everything that is inside it). But in order to populate the database with the PHP-Nuke tables, you will also need to upload the sql folder too. After the database creation (see Section 3.2.4), you should delete this folder though - for security reasons.

An operation that may be useful in cases of emergency is “Edit”, which is accessible from the context menu after a right click with the mouse on the desired file. “Edit” will allow a direct modification of the file, without the intermediate step of downloading it to your computer.

3.2.3. File permissions

ImportantImportant
 

This process only really applies if your PHP-Nuke will be installed on a Linux/Unix server, if instead you will install it on Windows operating systems you don't have to do anything.

Permissions:

Each file or directory[1] has 3 groups of permissions associated with it: one set of Read, Write or Execute permissions for the owner (also called “user” in this context), a group and "others" respectively. The owner in our case should be the user name of your web server. The group is a user group the web server is a member of. And “others” are just “the rest”.

File permissions are usually grouped together in groups of three, like this: (rwx)(rwx)(rwx). The first group are the user permissions, the second one the group permissions and the third one the permissions for “others”. A good mnemonic for this grouping is UGO (User, Group, Others). Inside each permissions group, a certain permission may or may not be present. Thus, the user (owner) of the file will usually have read and write permissions (and execute permission too, if the file is executable), but the group permissions may only allow read access and “others” may not be allowed to access the file at all, neither for reading, nor for writing or execution.

If you imagine that the existence of a permission is denoted by a 1, while its absence by a 0, then you end up with a representation like (111)(111)(111), where all permissions are present for all, or (000)(000)(000), where they are absent for all. Of course, any other combination is possible, for example (111)(110)100), which denotes read, write and execute permissions for the user (all 1s are present in the first grouping: (111)), read and write permissions for the group (only the first and second 1s are there in the second grouping (110)) and read permission for others (since only the first 1 is there, while the rest are 0s in the third grouping (100)).

Writing down a sequence of nine 0s and 1s is not very practical, so one came with the idea to interprete each one of the three groupings as a binary number. A (111) would thus mean a 7, a (110) a 6, a (100) a 4. Taken together, the sequence (111)(110)100) of the example above would be represented by the number 764. That's compact and widely used.

Unfortunately, it is also very cryptic, since most people didn't have much exposure to the binary number system at school, not to mention everyday life. How is one going to understand instructions like “set file permissions to 644” then?

Luckily, there exists an easy mnemonic for this: “4,2,1”, that is the first 1 counts as a 4, the second as a 2 and the third one as 1 - a 0 is always a 0, by the way, even in the binary system.

Whenever you see a 1 in the first position of a permissions triple, you add a 4, whenever you see one in the second, you add a 2 and if you see it in the third, you add 1. You do this for UGO, that is for User, Group and Others and you end up with a three digit number that represents the permissions of the file.

Most of the time, however, you will be busy deciphering permissions, rather than formulating them yourself in this cryptic manner. So how do you go about interpreting a permissions representation like 764 that was given to you in a document like the PHP-Nuke HOWTO?

For this, you will need to develop a “feeling” of how each of the three numbers (7, 6 and 4 in this example) can be written as a unique sum of 4s, 2s and 1s. For example 7 is 4+2+1, 6 is 4+2 and 4 is just 4. A 4 in the sum represents a 1 in the leftmost position. If a 4 is not present in the sum, the leftmost position is a 0. A 2 in the sum reperesents a 1 in the middle position - if there is no 2 in the sum, you just write a 0 there. Finally, a 1 in the sum represents a 1 in the rightmost position, while if there is no 1 in the sum, you write a 0 there.

Now if you remember that the leftmost 1 or 0 in a pattern like (111) denotes a read permission or the absence or it, a 1 or a 0 in the middle position denotes a write permission or its absence and a 1 or 0 in the leftmost position denotes an execute permission or its absence, then you can take a permissions represenation like 764 above, see that 7=4+2+1 and realize that it means (111), see that 6=4+2 (or 4+2+0, if you like) and realize that it means (110), finally see that 4=4 (or 4+0+0) and realize that it stands for (100), and you can see that 764 is equivalent to (111)(110)(100), meaning read, write and execute permissions for the user (owner), read and write permissions for the group and only read permissions for others.

Easy after all, isn't it?

For more information on permissions, see:

Setting up permissions on files serves the purpose of having them execute only certain operations (write, execute etc.) when called. Setting them up correctly is important for PHP-Nuke to operate in its full functionality.

The right permissions for PHP-Nuke are the following (for the base permissions, see Section 23.4.4 in the context of security):

Only directories that require upload access (like the forum's avatar folder, if you allow avatar upload) should be set to 777 and files that get data written to them by the program should be set to 666.

With WS_FTP you must select the files or folders on which you want to impose the permissions and, with the right mouse key, to select the option “chmod (UNIX)” (see Figure 3-4).

Figure 3-4. WS_FTP context menu on right mouse click: chmod (UNIX)

WS_FTP context menu on right mouse click: chmod (UNIX)

The window “Remote file permissions” will appear (see Figure 3-5). To change the permissions on a directory as required to 755, for example, check the boxes as shown in Figure 3-5 and press “OK”.

Figure 3-5. WS_FTP Remote file permissions window

WS_FTP Remote file permissions window

This procedure will cost you some time, but it is very important to carry out. Moreover, you will have to do it every time you insert a new file or module to your PHP-Nuke.

3.2.4. Database creation

Create a database that will contain the PHP-Nuke tables. The name of the database should be the same name as the one you entered in config.php (see Section 3.7):

mysqladmin create nuke

To populate the database, you have to run the nuke.sql file “through” mysql. Change to the sql directory and do from the command line:

mysql -h dbhost -u dbuname -p dbname < nuke.sql

where dbhost, dbuname and dbname are the database host, database username and database name, exactly as entered in config.php. Just as you import nuke.sql, you can import any other MySQL dump file (see also Section 3.4.2).

Notes

[1]

directories are just special files in Linux