If you see this text in your browser when you open install.php, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there.
0) || (count($aConfSkinsToImport) > 0) ) { global $CONF; $CONF['installscript'] = 1; } if (phpversion() >= '4.1.0') { include_once('nucleus/libs/vars4.1.0.php'); } else { include_once('nucleus/libs/vars4.0.6.php'); } include_once('nucleus/libs/mysql.php'); // check if mysql support is installed if (!function_exists('mysql_query') ) { _doError('Your PHP version does not have support for MySQL :('); } if (postVar('action') == 'go') { doInstall(); } else { showInstallForm(); } exit; function showInstallForm() { // 0. pre check if all necessary files exist doCheckFiles(); ?> Nucleus Install

Install Nucleus

This script will help you to install Nucleus. It will set up your MySQL database tables and provide you with the information you need to enter in config.php. In order to do all this, you need to enter some information.

All fields are mandatory. Optional information can be set from the Nucleus admin-area when installation is completed.

PHP & MySQL Versions

Below are the version numbers of the PHP interpreter and the MySQL server on your webhost. When reporting problems on the Nucleus Support Forum, please include this information.

Automatic config.php Update

If you want Nucleus to automatically update the config.php file, you'll need to make it writable. You can do this by changing the file permissions to 666. After Nucleus is successfully installed, you can change the permissions back to 444 (Quick guide on how to change file permissions).

If you choose not to make your file writable (or are unable to do so): don't worry. The installation process will provide you with the contents of the config.php file so you can upload it yourself.

MySQL login data

Enter your MySQL data below. This install script needs it to be able to create and fill your database tables. Afterwards, you'll also need to fill it out in config.php.

If you don't know this information, contact your system administrator for more info. Often, the hostname will be 'localhost'. If Nucleus found a 'default MySQL host' in the PHP settings of your server, this host is already listed in the 'hostname' field. There's no guarantee that this information is correct, though.

General Database Settings
Hostname:
Username:
Password:
Database: ()
Advanced Database Settings

Unless you're installing multiple Nucleus installations in one single database and know what you're doing, you really shouldn't change this.

All database tables generated by Nucleus will start with this prefix.

Directories and URLs

This install script has attempted to find out the directories and URLs in which Nucleus is installed. Please check the values below and correct if necessary. The URLs and file paths should end with a slash.

URLs and directories
Site URL:
Admin-area URL:
Admin-area path:
Media files URL:
Media directory path:
Extra skin files URL:
(used by imported skins)
Extra skin files directory path:
(this is where imported skins can place their extra files)
Plugin files URL:
Action URL:
(absolute location of the action.php file)

Note: Use absolute paths instead of relative paths. Usually, an absolute path will start with something like /home/username/public_html/. On Unix systems (most servers), paths should start with a slash. If you have trouble filling out this information, you should ask your administrator what to fill out.

Administrator User

Below, you need to enter some information to create the first user of your site.

Administrator User
Display Name: (allowed characters: a-z and 0-9, spaces allowed inside)
Real Name:
Password:
Password Again:
E-mail Address: (needs to be a valid e-mail address)

Weblog data

Below, you need to enter some information to create a default weblog. The name of this weblog will also be used as name for your site

Weblog Data
Blog Name:
Blog Short Name: (allowed characters: a-z and 0-9, no spaces allowed)

Submit

Verify the data above, and click the button below to set up your database tables and initial data. This can take a while, so have patience. ONLY CLICK THE BUTTON ONCE !

0) { showErrorMessages($errors); } // 2. try to log in to mySQL global $MYSQL_CONN; $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password); if ($MYSQL_CONN == false) { _doError('Could not connect to mySQL server: ' . mysql_error() ); } // 3. try to create database (if needed) if ($mysql_create == 1) { mysql_query('CREATE DATABASE ' . $mysql_database) or _doError('Could not create database. Make sure you have the rights to do so. SQL error was: ' . mysql_error() ); } // 4. try to select database mysql_select_db($mysql_database) or _doError('Could not select database. Make sure it exists'); // 5. execute queries $filename = 'install.sql'; $fd = fopen($filename, 'r'); $queries = fread($fd, filesize($filename) ); fclose($fd); $queries = split("(;\n|;\r)", $queries); $aTableNames = array( 'nucleus_actionlog', 'nucleus_ban', 'nucleus_blog', 'nucleus_category', 'nucleus_comment', 'nucleus_config', 'nucleus_item', 'nucleus_karma', 'nucleus_member', 'nucleus_plugin', 'nucleus_skin', 'nucleus_template', 'nucleus_team', 'nucleus_activation', 'nucleus_tickets' ); // these are unneeded (one of the replacements above takes care of them) // 'nucleus_plugin_event', // 'nucleus_plugin_option', // 'nucleus_plugin_option_desc', // 'nucleus_skin_desc', // 'nucleus_template_desc', $aTableNamesPrefixed = array( $mysql_prefix . 'nucleus_actionlog', $mysql_prefix . 'nucleus_ban', $mysql_prefix . 'nucleus_blog', $mysql_prefix . 'nucleus_category', $mysql_prefix . 'nucleus_comment', $mysql_prefix . 'nucleus_config', $mysql_prefix . 'nucleus_item', $mysql_prefix . 'nucleus_karma', $mysql_prefix . 'nucleus_member', $mysql_prefix . 'nucleus_plugin', $mysql_prefix . 'nucleus_skin', $mysql_prefix . 'nucleus_template', $mysql_prefix . 'nucleus_team', $mysql_prefix . 'nucleus_activation', $mysql_prefix . 'nucleus_tickets' ); // these are unneeded (one of the replacements above takes care of them) // $mysql_prefix . 'nucleus_plugin_event', // $mysql_prefix . 'nucleus_plugin_option', // $mysql_prefix . 'nucleus_plugin_option_desc', // $mysql_prefix . 'nucleus_skin_desc', // $mysql_prefix . 'nucleus_template_desc', $count = count($queries); for ($idx = 0; $idx < $count; $idx++) { $query = trim($queries[$idx]); // echo "QUERY = " . htmlspecialchars($query) . "

"; if ($query) { if ($mysql_usePrefix == 1) { $query = str_replace($aTableNames, $aTableNamesPrefixed, $query); } mysql_query($query) or _doError('Error while executing query (' . htmlspecialchars($query) . '): ' . mysql_error() ); } } // 6. update global settings updateConfig('IndexURL', $config_indexurl); updateConfig('AdminURL', $config_adminurl); updateConfig('MediaURL', $config_mediaurl); updateConfig('SkinsURL', $config_skinsurl); updateConfig('PluginURL', $config_pluginurl); updateConfig('ActionURL', $config_actionurl); updateConfig('AdminEmail', $config_adminemail); updateConfig('SiteName', $config_sitename); // 7. update GOD member $query = 'UPDATE ' . tableName('nucleus_member') . " SET mname='" . addslashes($user_name) . "'," . " mrealname='" . addslashes($user_realname) . "'," . " mpassword='" . md5(addslashes($user_password) ) . "'," . " murl='" . addslashes($config_indexurl) . "'," . " memail='" . addslashes($user_email) . "'," . " madmin=1, mcanlogin=1" . " WHERE mnumber=1"; mysql_query($query) or _doError('Error while setting member settings: ' . mysql_error() ); // 8. update weblog settings $query = 'UPDATE ' . tableName('nucleus_blog') . " SET bname='" . addslashes($blog_name) . "'," . " bshortname='" . addslashes($blog_shortname) . "'," . " burl='" . addslashes($config_indexurl) . "'" . " WHERE bnumber=1"; mysql_query($query) or _doError('Error while setting weblog settings: ' . mysql_error() ); // 9. update item date $query = 'UPDATE ' . tableName('nucleus_item') . " SET itime='" . date('Y-m-d H:i:s', time() ) ."'" . " WHERE inumber=1"; mysql_query($query) or _doError('Error with query: ' . mysql_error() ); global $aConfPlugsToInstall, $aConfSkinsToImport; $aSkinErrors = array(); $aPlugErrors = array(); if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) ) { // 10. set global variables global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX; $MYSQL_HOST = $mysql_host; $MYSQL_USER = $mysql_user; $MYSQL_PASSWORD = $mysql_password; $MYSQL_DATABASE = $mysql_database; $MYSQL_PREFIX = ($mysql_usePrefix == 1)?$mysql_prefix:''; global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS; $DIR_NUCLEUS = $config_adminpath; $DIR_MEDIA = $config_mediapath; $DIR_SKINS = $config_skinspath; $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/'; $DIR_LANG = $DIR_NUCLEUS . 'language/'; $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; // close database connection (needs to be closed if we want to include globalfunctions.php) mysql_close(); $manager = ''; include_once($DIR_LIBS . 'globalfunctions.php'); // 11. install custom skins $aSkinErrors = installCustomSkins($manager); // 12. install custom plugins $aPlugErrors = installCustomPlugs($manager); } // 12. Write config file ourselves (if possible) $bConfigWritten = 0; if (@file_exists('config.php') && is_writable('config.php') && $fp = @fopen('config.php', 'w') ) { $config_data = '<' . '?php' . "\n\n"; //$config_data .= "\n"; (extraneous, just added extra \n to previous line $config_data .= " // mySQL connection information\n"; $config_data .= " \$MYSQL_HOST = '" . $mysql_host . "';\n"; $config_data .= " \$MYSQL_USER = '" . $mysql_user . "';\n"; $config_data .= " \$MYSQL_PASSWORD = '" . $mysql_password . "';\n"; $config_data .= " \$MYSQL_DATABASE = '" . $mysql_database . "';\n"; $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1)?$mysql_prefix:'') . "';\n"; $config_data .= "\n"; $config_data .= " // main nucleus directory\n"; $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n"; $config_data .= "\n"; $config_data .= " // path to media dir\n"; $config_data .= " \$DIR_MEDIA = '" . $config_mediapath . "';\n"; $config_data .= "\n"; $config_data .= " // extra skin files for imported skins\n"; $config_data .= " \$DIR_SKINS = '" . $config_skinspath . "';\n"; $config_data .= "\n"; $config_data .= " // these dirs are normally sub dirs of the nucleus dir, but \n"; $config_data .= " // you can redefine them if you wish\n"; $config_data .= " \$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n"; $config_data .= " \$DIR_LANG = \$DIR_NUCLEUS . 'language/';\n"; $config_data .= " \$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n"; $config_data .= "\n"; $config_data .= " // include libs\n"; $config_data .= " include(\$DIR_LIBS.'globalfunctions.php');\n"; $config_data .= "?" . ">"; $result = @fputs($fp, $config_data, strlen($config_data) ); fclose($fp); if ($result) { $bConfigWritten = 1; } } ?> Nucleus Install

0) { echo '

Skin/Plugin Install errors

'; echo ''; } if (!$bConfigWritten) { ?>

Installation Almost Complete!

The database tables have been initialized successfully. What still needs to be done is to change the contents of config.php. Below is how it should look like (the mysql password is masked, so you'll have to fill that out yourself)

<?php
	// mySQL connection information
	$MYSQL_HOST = '';
	$MYSQL_USER = '';
	$MYSQL_PASSWORD = 'xxxxxxxxxxx';
	$MYSQL_DATABASE = '';
	$MYSQL_PREFIX = '';

	// main nucleus directory
	$DIR_NUCLEUS = '';

	// path to media dir
	$DIR_MEDIA = '';

	// extra skin files for imported skins
	$DIR_SKINS = '';

	// these dirs are normally sub dirs of the nucleus dir, but
	// you can redefine them if you wish
	$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
	$DIR_LANG = $DIR_NUCLEUS . 'language/';
	$DIR_LIBS = $DIR_NUCLEUS . 'libs/';

	// include libs
	include($DIR_LIBS.'globalfunctions.php');
?>

After you changed the file on your computer, upload it to your web server using FTP. Make sure you use ASCII mode to send over the files.

Note: Make sure that you have no spaces at the beginning or end of the config.php file. These would cause errors to happen when performing certain actions.
Thus, the first character of config.php should be "<", and the last character should be ">".

Installation complete!

Nucleus has been installed, and your config.php has been updated for you.

Don't forget to change the permissions on config.php back to 444 for security (Quick guide on how to change file permissions).

Fight against Spam

Nucleus CMS allows every visitor to write comments in blogs. So there is a high risk that spammers abuse this function. We recommend that you protect your blog with one of the following methods:

Delete your install files

Files you should delete from your web server:

If you don't delete these files, you won't be able to open the admin area

Visit your web site

Your web site is now ready to use.

getPlugin($plugName); if (!$plugin) { sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\'' . addslashes($plugName) . '\''); $numCurrent--; array_push($aErrors, 'Unable to install plugin ' . $plugName); continue; } $plugin->install(); } // SYNC PLUGIN EVENT LIST sql_query('DELETE FROM ' . sql_table('plugin_event') ); // loop over all installed plugins $res = sql_query('SELECT pid, pfile FROM ' . sql_table('plugin') ); while($o = mysql_fetch_object($res) ) { $pid = $o->pid; $plug =& $manager->getPlugin($o->pfile); if ($plug) { $eventList = $plug->getEventList(); foreach ($eventList as $eventName) { sql_query('INSERT INTO ' . sql_table('plugin_event') . ' (pid, event) VALUES (' . $pid . ', \'' . $eventName . '\')'); } } } return $aErrors; } function installCustomSkins(&$manager) { global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS; $aErrors = array(); if (count($aConfSkinsToImport) == 0) { return $aErrors; } // load skinie class include_once($DIR_LIBS . 'skinie.php'); $importer = new SKINIMPORT(); foreach ($aConfSkinsToImport as $skinName) { $importer->reset(); $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml'; if (!@file_exists($skinFile) ) { array_push($aErrors, 'Unable to import ' . $skinFile . ' : file does not exist'); continue; } $error = $importer->readFile($skinFile); if ($error) { array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); continue; } $error = $importer->writeToDatabase(1); if ($error) { array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); continue; } } return $aErrors; } // give an error if one or more nucleus are not accessible function doCheckFiles() { $missingfiles = array(); $files = array( 'install.sql', 'index.php', 'action.php', 'nucleus/index.php', 'nucleus/libs/globalfunctions.php', 'nucleus/libs/ADMIN.php', 'nucleus/libs/BLOG.php', 'nucleus/libs/COMMENT.php', 'nucleus/libs/COMMENTS.php', 'nucleus/libs/ITEM.php', 'nucleus/libs/MEMBER.php', 'nucleus/libs/SKIN.php', 'nucleus/libs/TEMPLATE.php', 'nucleus/libs/MEDIA.php', 'nucleus/libs/ACTIONLOG.php', 'nucleus/media.php' ); $count = count($files); for ($i = 0; $i < $count; $i++) { if (!is_readable($files[$i]) ) { array_push($missingfiles, 'File ' . $files[$i] . ' is missing or not readable.'); } } // The above code replaces several if statements of the form: // if (!is_readable('install.sql') ) { // array_push($missingfiles, 'File install.sql is missing or not readable'); // } if (count($missingfiles) > 0) { showErrorMessages($missingfiles); } } function updateConfig($name, $val) { $name = addslashes($name); $val = trim(addslashes($val) ); $query = 'UPDATE ' . tableName('nucleus_config') . " SET value='$val'" . " WHERE name='$name'"; mysql_query($query) or _doError('Query error while trying to update config: ' . mysql_error() ); return mysql_insert_id(); } function replaceDoubleBackslash($input) { return str_replace('\\', '/', $input); } function endsWithSlash($s) { return (strrpos($s, '/') == strlen($s) - 1); } /** * Checks if email address is valid */ function _isValidMailAddress($address) { if (preg_match("/^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$/", $address) ) { return 1; } else { return 0; } } // returns true if the given string is a valid shortname // (to check short blog names and nicknames) // logic: starts and ends with a non space, can contain spaces in between // min 2 chars function _isValidShortName($name) { if (eregi("^[a-z0-9]+$", $name) ) { return 1; } else { return 0; } } // returns true if the given string is a valid display name // (to check nicknames) function _isValidDisplayName($name) { if (eregi("^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$", $name) ) { return 1; } else { return 0; } } function _doError($msg) { ?> Nucleus Install

Error!

Error message was: "";

Go Back

Nucleus Install

Errors!

Errors were found:

Go Back