\n"; } function javascript_tag($filename) { $query = ""; if (!(strpos($filename, "?") === false)) { $query = substr($filename, strpos($filename, "?")+1); $filename = substr($filename, 0, strpos($filename, "?")); } $timestamp = filemtime($filename); if ($query) $timestamp .= "&$query"; return "\n"; } ?> Tiny Tiny RSS - Installer $msg"; } function print_notice($msg) { print "
$msg
"; } function pdo_connect($host, $user, $pass, $db, $type, $port = false) { $db_port = $port ? ';port=' . $port : ''; $db_host = $host ? ';host=' . $host : ''; try { $pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port, $user, $pass); return $pdo; } catch (Exception $e) { print "
" . $e->getMessage() . "
"; return null; } } function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, $DB_PORT, $SELF_URL_PATH) { $rv = file_get_contents("../config.php-dist"); $escape_chars = "\\'"; $settings = [ "%DB_TYPE" => $DB_TYPE == 'pgsql' ? 'pgsql' : 'mysql', "%DB_HOST" => addcslashes($DB_HOST, $escape_chars), "%DB_USER" => addcslashes($DB_USER, $escape_chars), "%DB_NAME" => addcslashes($DB_NAME, $escape_chars), "%DB_PASS" => addcslashes($DB_PASS, $escape_chars), "%DB_PORT" => $DB_PORT ? intval($DB_PORT) : '', "%SELF_URL_PATH" => addcslashes($SELF_URL_PATH, $escape_chars) ]; $rv = str_replace(array_keys($settings), array_values($settings), $rv); return $rv; } function is_server_https() { return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'); } function make_self_url_path() { $url_path = (is_server_https() ? 'https://' : 'http://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); return $url_path; } ?>

Tiny Tiny RSS Installer

"; exit; } } @$op = $_REQUEST['op']; @$DB_HOST = strip_tags($_POST['DB_HOST']); @$DB_TYPE = strip_tags($_POST['DB_TYPE']); @$DB_USER = strip_tags($_POST['DB_USER']); @$DB_NAME = strip_tags($_POST['DB_NAME']); @$DB_PASS = strip_tags($_POST['DB_PASS']); @$DB_PORT = strip_tags($_POST['DB_PORT']); @$SELF_URL_PATH = strip_tags($_POST['SELF_URL_PATH']); if (!$SELF_URL_PATH) { $SELF_URL_PATH = preg_replace("/\/install\/$/", "/", make_self_url_path()); } ?>

Database settings

If needed
Usually 3306 for MySQL or 5432 for PostgreSQL

Other settings

This should be set to the location your Tiny Tiny RSS will be available on.

Checking configuration

0) { print "

Some configuration tests failed. Please correct them before continuing.

"; print ""; exit; } $notices = array(); if (!function_exists("curl_init")) { array_push($notices, "It is highly recommended to enable support for CURL in PHP."); } if (function_exists("curl_init") && ini_get("open_basedir")) { array_push($notices, "CURL and open_basedir combination breaks support for HTTP redirects. See the FAQ for more information."); } if (!function_exists("idn_to_ascii")) { array_push($notices, "PHP support for Internationalization Functions is required to handle Internationalized Domain Names."); } if ($DB_TYPE == "mysql" && !function_exists("mysqli_connect")) { array_push($notices, "PHP extension for MySQL (mysqli) is missing. This may prevent legacy plugins from working."); } if ($DB_TYPE == "pgsql" && !function_exists("pg_connect")) { array_push($notices, "PHP extension for PostgreSQL is missing. This may prevent legacy plugins from working."); } if (count($notices) > 0) { print_notice("Configuration check succeeded with minor problems:"); print ""; } else { print_notice("Configuration check succeeded."); } ?>

Checking database

Initialize database

Before you can start using tt-rss, database needs to be initialized. Click on the button below to do that now.

query("SELECT true FROM ttrss_feeds"); if ($res && $res->fetch()) { print_error("Some tt-rss data already exists in this database. If you continue with database initialization your current data WILL BE LOST."); $need_confirm = true; } else { $need_confirm = false; } ?>

Initializing database..."; $lines = explode(";", preg_replace("/[\r\n]/", "", file_get_contents("../schema/ttrss_schema_".basename($DB_TYPE).".sql"))); foreach ($lines as $line) { if (strpos($line, "--") !== 0 && $line) { $res = $pdo->query($line); if (!$res) { print_notice("Query: $line"); print_error("Error: " . implode(", ", $pdo->errorInfo())); } } } print_notice("Database initialization completed."); } else { print_notice("Database initialization skipped."); } print "

Generated configuration file

"; print "

Copy following text and save as config.php in tt-rss main directory. It is suggested to read through the file to the end in case you need any options changed fom default values.

"; print "

After copying the file, you will be able to login with default username and password combination: admin and password. Don't forget to change the password immediately!

"; ?>
"; echo htmlspecialchars(make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, $DB_PORT, $SELF_URL_PATH)); print ""; ?>

We can also try saving the file automatically now.

Saving configuration file to parent directory..."; if (!file_exists("../config.php")) { $fp = fopen("../config.php", "w"); if ($fp) { $written = fwrite($fp, make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, $DB_PORT, $SELF_URL_PATH)); if ($written > 0) { print_notice("Successfully saved config.php. You can try loading tt-rss now."); } else { print_notice("Unable to write into config.php in tt-rss directory."); } fclose($fp); } else { print_error("Unable to open config.php in tt-rss directory for writing."); } } else { print_error("config.php already present in tt-rss directory, refusing to overwrite."); } } ?>