# Installing Geeklog

> New Installation | Upgrading To New Version | Common Problems

> - Pre-Installation Checklist
> - Installation Instructions

> - Pre-Upgrade Checklist
> - Upgrade Instructions

> - Installation
> - Post-Installation

> Glossary
> - path: A physical location on a server that describes where files and directories are. On Windows paths begin with the drive letter (`c:/inetpub/wwwroot/`), on *nix paths start at root (`/`) like (`/var/www/`)
> - url: Uniform Resource Locator, the address of a specific piece of information on the web (`http://www.foo.com/`)

PRE-INSTALLATION CHECKLIST (new installation)

Before installing Geeklog for the first time, please make sure you have or know the following:

1. A web server running PHP 4.04 or higher
2. A web server running MySQL, with access to a database or the ability to create a database
3. The ability to create a new database in MySQL or access to an existing one
4. A telnet or SSH connection to your web server (although FTP will work). This document will be written assuming you have command line access to your server, but we will note the major differences for FTP users.
5. The ability to unpack a tarball (file ending in tar.gz)
6. You know the difference between a path and a URL
7. You know how to determine your system paths

   SPECIAL NOTE ABOUT PARSE ERRORS:

   Some users have reported that WinZip corrupts certain files in the Geeklog tarball during decompression which will cause errors during the installation process. You are strongly urged not to use WinZip. Try WinRAR if you must decompress the file locally, or better yet, unpack the file from your server (requires telnet/SSH access).

   Parse errors can also be caused by using a WYSIWYG editor on lib-common.php, e.g. Dreamweaver - you should use a "plain text editor".

The following instructions will refer to the `public_html` directory a lot. Here is what this is all about:

Basically, a Geeklog installation consists of two parts: The part that is visible "to the world" - which is everything in the public_html directory. "public_html" is a popular name for the world-accessible directory that can be found on a webserver ("htdocs" and "www" are other popular names). So if you have such a directory, just copy everything from Geeklog's public_html directory into that directory on your webserver. Then you only need to set up $_CONF['path_html'] (in config.php) to point to that directory.

The other part of Geeklog, which is everything outside the public_html directory, should not be accessible via a URL since it contains sensitive information. So you should really put those files and directories outside of your document root (i.e. outside the web server's public_html, htdocs, or www directory). Then you only need to set up $_CONF['path'] (again, in config.php) to point to the place where you put those files and directories.

Separating the install in this way will also ensure that you can access your Geeklog site directly via a domain name (if you have one), e.g. http://www.yourdomain.com/, and that you don't need to include "public_html" in the URL.

INSTALLATION INSTRUCTIONS (new installation)

Please read this section COMPLETELY before beginning.

1. Unpack the tarball *within* your web tree by running the following in your shell (this assumes you have ssh access and that you are working with the tarball on the designated server - this can be locally or hosted elsewhere):
   `tar -zxvf geeklog-1.3.9rc2.tar.gz`
   FTP, Windows Users: unpack the tarball on your local computer and upload the result to your designated server. Everything uploads as ASCII except the images.
2. For *nix installations the following may be required:
   `chown -R webuser:webuser /path/to/geeklog`
   This guarantees that everything in that path belongs to you, typical settings are www:www or nobody:nobody and more often than not doesn't matter.
3. For *nix installations cd into /path/to/geeklog and do the following:
   `chmod -R 775 logs/
   chmod -R 775 public_html/backend/
   chmod -R 775 public_html/images/articles
   chmod -R 775 public_html/images/userphotos`
   FTP Users: If you're doing the chmod via a FTP client, you must also apply the chmod to the files in logs/ and public_html/backend as well as the directories themselves. Most, if not all, ftp clients do not perform this command recursively. That means you need to set each file within each of these directories manually.

   SPECIAL NOTE:

   Not following step #3 correctly is the #1 reason why people receive errors when they first try to use Geeklog. Take your time and get it right. Also, some users have reported problems if the above permissions are not set to 777. Try 775 first and only be more permissive if you receive an error message.

   There is also a script at http://yourgeeklogsite/admin/install/check.php that can test the permissions for you.

4. Create the database you want Geeklog to reside in. You only need to create an empty database - the install script (see below) will create the tables for you.
   If you are not familiar with using MySQL, you are urged to get phpMyAdmin and use it to create a new database. If you have no idea what the previous two sentences mean, contact your sysadmin for help.
5. Edit config.php with the appropriate settings for your server. For installation, this basically means "set your paths," as all other variables can be changed after a successful installation. The config.php file contains comments to help you out.
   Windows users, you should be able to use the Unix '/' in your paths without any problems. Otherwise, you will need to use the doubled Windows slashes '\\'.
   Please read the comments in config.php carefully.
6. Edit lib-common.php and change the require_once() at the top to point to the location of your config.php file.
7. Open your browser and navigate to http://yourgeeklogsite/admin/install/install.php and follow the directions!
8. Once you see the success message, you are ready to go. You can now delete the admin/install directory (and all files within it).
9. Read the first story on your Geeklog site to learn how to log in as the administrator. Please remember to change the default passwords on all pre-configured accounts right away.

If you run into problems or keep getting error messages, please see the section on common installation problems below.

PRE-UPGRADE CHECKLIST (upgrade)

WARNING:

Take extreme care to back up any files from your current Geeklog installation that have any custom code in them, especially lib-custom.php (where all custom code should reside). Be sure to back up any modified themes, images, and static pages from your current installation.

Also, please be sure to back up your database. We can't stress the importance of backing up your files and database enough.

YOU HAVE BEEN WARNED.

UPGRADE INSTRUCTIONS (upgrade)

Upgrading is no different than a fresh installation except your database already exists and needs to be upgraded.

1. Back up any files with custom code in them and back up your database.

   SPECIAL NOTE: Please pay special attention to the older config.php and lib-common.php files, as these files contain database and path information you entered the last time you installed Geeklog and this information MUST be copied over to the NEW config.php and lib-common.php files.

2. You can choose to either rename or remove your current Geeklog directory. Although in the end you will be deleting the older install it's probably safer to keep the old copy around for a few days *just* in-case you forgot to transfer some files.
3. Uncompress the new version and copy the result to the same path that your old installation had. For instance, if your old Geeklog was in `/usr/home/www/geeklog/`, then your new installation should also be in `/usr/home/www/geeklog/`.
4. As with a fresh install, edit your config.php and lib-common.php, basically just copying over the information from your old copies of these files.
5. If you are upgrading from Geeklog 1.2 or earlier, change to `/path/to/geeklog/sql/updates` and apply all needed database updates. For example, if you are upgrading from Geeklog 1.1, you will need to apply 1.1_to_1.2.sql and 1.2_to_1.2.2.sql which will upgrade your database to Geeklog 1.2.5-1. I say 1.2.5-1 because there were no database changes from 1.2.2 to 1.2.5-1 (e.g. a 1.2.2 database is the same as a 1.2.5-1 database). If you are uncomfortable using the MySQL command line to do this, you can do it via phpMyAdmin as well.
   If you are upgrading from Geeklog 1.3 or later, you can skip this step.
6. Open your browser and navigate to http://yourgeeklogsite/admin/install/install.php. Enter your path to Geeklog and make sure you select Upgrade Database as the installation type, before you click on the "Next" button. The second step of the installation script should have an option to convert your database to the current version.
   Please note that only "basic" version numbers are listed, because, for example, Geeklog 1.3.7 and 1.3.7sr2 use the same database. So if you're upgrading from Geeklog 1.3.7sr2, just select "1.3.7" (the same applies to 1.3.5 / 1.3.5sr1 / 1.3.5sr2 and all the various 1.3.8 versions).
7. Once you see the success message, your upgrade is complete. You can now delete the admin/install directory (and all files within it).

INSTALLATION PROBLEMS (common problems)

SPECIAL NOTE: Before you go any further, please open config.php AND DOUBLE CHECK YOUR PATHS. Bad paths, or typos in the paths will cause all sorts of errors in Geeklog.

When you get an error message, please read it carefully. Even if you're not familiar with PHP, it will give you a hint about what is wrong. Pay special attention at the paths contained in the error message. Wrong paths are the most common cause for problems.

If you get more than one error message, always start with the very first error - the others will often go away automatically once you've fixed the first one.

I get the following error: `Parse error: parse error in /path/to/your/config.php on line 76`

(line number may vary)

Answer:

A parse error usually hints at a typo you've made. Check the file at the given line (the actual error may be in the line preceding the one mentioned in the error message).

Common problems are:

- not enclosing paths in single quotes properly
- missing semicolon at the end of the line
- using single quotes within a string (you need to write Joe's Site as Joe\'s Site, escaping the extra quote)

I get the following errors: `Warning: main(some/path/to/system/databases/mysql.class.php): failed to open stream: No such file or directory in /path/to/your/system/lib-database.php on line 110` `Fatal error: main(): Failed opening required 'some/path/to/system/databases/mysql.class.php' (include_path='.:/some/other/path/') in /some/path/to/system/lib-database.php on line 110`
(line numbers may vary) Answer: The path that you've entered for the $_CONF['path'] variable in config.php is not correct. Make sure you typed it correctly. Also make sure it uses an absolute path, i.e. one that starts at the root of your file system (and that it starts with a / under Unix/Linux or a drive letter under Windows).

I get the following error: `1050: Table 'gl_access' already exists`
Answer: You must have run the install script before (possibly unsuccessfully). To be on the save side, drop the database and create a new, empty database before trying to run the install script again.

During installation, I get one of the following errors:

Case 1:

`Parse error: parse error in ../../lib-common.php on line 2231`

`Fatal error: Cannot instantiate non-existent class: template in ../../lib-common.php on line 335`

Case 2:

`Parse error: parse error in /path/to/geeklog/public_html/lib-common.php on line 3036`

`Fatal error: Call to undefined function: plg_showcenterblock() in /path/to/geeklog/public_html/index.php on line 67`

Case 3:

`Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /path/to/geeklog/public_html/lib-common.php on line 3815`

`Fatal error: Cannot instantiate non-existent class: template in /path/to/geeklog/public_html/lib-common.php on line 709`

(line numbers may vary)

Answer:

All of the above cases (and similar "parse error" messages you may get for lib-common.php, typically with a line number in the 3000 or 4000 range) indicate a corrupted lib-common.php file.

As noted at the top of this document this is usually caused by one of the following:

- Uncompressing the tarball with certain versions of WinZip (try using WinRar instead)
- Editing the lib-common.php with Dreamweaver or other so-called WYSIWYG HTML editors (use a simple text editor instead)
- Editing the lib-common.php with "on-site" text editors built into tools like Cpanel (again, use a simple text editor instead)

You will need to unpack a fresh copy of the lib-common.php and edit it again, using a "normal" text editor. Windows users can find some recommendations for editors to use in this and this thread in the forums on geeklog.net.

I get the following error: `Template Error: set_root: /some/path/to/public_html/layout/XSilver is not a directory. Halted.`
Answer: This is a path problem again. Check the setting for $_CONF['path_html']. If you did not change or rename Geeklog's `public_html` directory, then there's no need to change that setting at all (restore the line to its original content). Otherwise, please read the comments above that line in config.php again carefully to understand how to change that line properly.

I get the following error: `Warning: mysql_connect(): Access denied for user: 'username@localhost' (Using password: YES) in /path/to/geeklog/system/databases/mysql.class.php on line 104 Cannnot connect to DB server`

(line number may vary)

Answer:

First of all, make sure the database settings in `config.php` are correct, specifically the name and password of your MySQL user, the name of your database, and the name of your MySQL server.

If you're running your own server, you may need to give your MySQL user proper permissions. Log in to MySQL as the MySQL root user and issue these commands:

`GRANT ALL PRIVILEGES ON database_name TO user@host IDENTIFIED BY 'password';
FLUSH PRIVILEGES;`

Replacing the lower-case strings with the actual values, of course.

If you want (or need) to be more restrictive with database permissions: You will need to at least grant the ALTER, CREATE, DELETE, INSERT, SELECT, and UPDATE permissions to your database user. ALTER and CREATE permissions are only needed for installing and upgrading Geeklog, as well as for installing plugins and other add-ons.

POST-INSTALL PROBLEMS (common problems)

I've set up my site successfully, but get the following error message on the top: `Warning: fopen("/some/path/logs/error.log", "a") - Permission denied in /some/path/public_html/lib-common.php on line 1440`

(line number may vary)

Answer:

Make sure that the logs/ directory AND the files in it have permissions of at least 775. You may need to make the permissions 777 if 775 isn't working for you. For good measure, make sure the public_html/backend directory and the geeklog.rdf file have the same 775 or 777 permissions.

Tip: Use the script that is located at http://yourgeeklogsite/admin/install/check.php to test if all the permissions have been set up correctly.

Whenever someone tries to log in or out, the following error is produced: `Cannot add header information - headers already sent by (output started at /usr###/home/<userid>/public_html/geeklog/config.php:589) in /usr###/home/<userid>/public_html/geeklog/system/lib-sessions.php on line 133`
(line numbers may vary) Answer: Make sure that your config.php file does not contain any "whitespace" after the closing ?> at the end of the file. I.e. there should not be anything (not even blanks or empty lines) after those two characters.

If you still have problems, please do one or more of the following:

1) Go to http://www.geeklog.net and check out the Support section. The Support section includes a FAQ and a search system (try searching for the error message, if you get one).

2) Visit the mailing list archives at http://lists.geeklog.net/pipermail/geeklog-users/. You can also subscribe to the mailing list and post your question to the Geeklog community.

3) Try the chat room at irc.freenode.net, channel #geeklog. Please have all your path information in config.php and lib-common.php readily available.

4) Try entering the text of the error message on Google. Chances are you will find someone else who had the same problem and fixed it. And sometimes searching for a specific error will cause Google to bring up broken pages that have the same error.

Extended version of this document created by Jason C. Levine,
layout by Simon Lord, reviewed by Dirk Haun and Jeffrey Schoolcraft.