Unable to make TTRSS work : PHP errors

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
chris777
Bear Rating Trainee
Bear Rating Trainee
Posts: 13
Joined: 30 Jan 2017, 20:37

Unable to make TTRSS work : PHP errors

Postby chris777 » 30 Jan 2017, 20:54

Hi,
I'm new to TTRSS.
This is the first time I use your reader, but unfortunately I'm not able to make it work properly.
I use Ubuntu 16.04LTS 64 bit for the server.
I use mariadb and php 7.0
I installed every package for php since I'm still not able to make it work :

Code: Select all

apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

dh-php/xenial,xenial,now 0.10 all [installed,automatic]
php-common/xenial,xenial,now 1:35ubuntu6 all [installed,automatic]
php-pear/xenial,xenial,now 1:1.10.1+submodules+notgz-6 all [installed,automatic]
php7.0/xenial-updates,xenial-updates,now 7.0.13-0ubuntu0.16.04.1 all [installed]
php7.0-bcmath/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-bz2/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-cgi/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-cli/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-common/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-curl/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-dba/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-dev/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-enchant/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-fpm/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-gd/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-gmp/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-imap/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-interbase/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-intl/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-json/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-ldap/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-mbstring/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-mcrypt/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-mysql/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-odbc/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-opcache/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-pgsql/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-phpdbg/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-pspell/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-readline/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-recode/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-snmp/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-soap/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-sqlite3/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-sybase/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-tidy/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-xml/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-xmlrpc/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
php7.0-xsl/xenial-updates,xenial-updates,now 7.0.13-0ubuntu0.16.04.1 all [installed]
php7.0-zip/xenial-updates,now 7.0.13-0ubuntu0.16.04.1 amd64 [installed]
pkg-php-tools/xenial,xenial,now 1.32ubuntu2 all [installed,automatic]


I cloned ttrss version from git, so it's uptodate.

I have created config.php (BTW it looks like it's missing the ?> at the end)

Code: Select all

       define('DB_TYPE', "mysql");
        define('DB_HOST', "localhost");
        define('DB_USER', "ttrss");
        define('DB_NAME', "ttrssdb");
        define('DB_PASS', "XXXXXXXXX");
        define('DB_PORT', '3306');
        define('SELF_URL_PATH', 'http://mysite.net/tt-rss');


browsing http://mysite.net/tt-rss throws :

Code: Select all

Fatal Error INDEX: You forgot to copy config.php-dist to config.php and edit it.\n"; // exit; } // we need a separate check here because functions.php might get parsed // incorrectly before 5.3 because of :: syntax. if (version_compare(PHP_VERSION, '5.3.0', '<')) { print "Fatal Error: PHP version 5.3.0 or newer required.\n"; // exit; } set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . get_include_path()); require_once "autoload.php"; require_once "sessions.php"; require_once "functions.php"; require_once "sanity_check.php"; require_once "version.php"; require_once "config.php"; require_once "db-prefs.php"; require_once "lib/Mobile_Detect.php"; $mobile = new Mobile_Detect(); if (!init_plugins()) return; if (!$_REQUEST['mobile']) { if ($mobile->isTablet() && PluginHost::getInstance()->get_plugin("digest")) { header('Location: backend.php?op=digest'); exit; } else if ($mobile->isMobile() && PluginHost::getInstance()->get_plugin("mobile")) { header('Location: backend.php?op=mobile'); exit; } else if ($mobile->isMobile() && PluginHost::getInstance()->get_plugin("digest")) { header('Location: backend.php?op=digest'); exit; } } login_sequence(); header('Content-Type: text/html; charset=utf-8'); ?>
get_hooks(PluginHost::HOOK_MAIN_TOOLBAR_BUTTON) as $p) { echo $p->hook_main_toolbar_button(); } ?>
get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) { echo $p->hook_toolbar_button(); } ?>



And if I remove config.php and browse http://mysite.net/tt-rss/install it throws :

Code: Select all

$msg"; } function print_notice($msg) { print "
$msg
"; } function db_connect($host, $user, $pass, $db, $type, $port = false) { if ($type == "pgsql") { $string = "dbname=$db user=$user"; if ($pass) { $string .= " password=$pass"; } if ($host) { $string .= " host=$host"; } if ($port) { $string = "$string port=" . $port; } $link = pg_connect($string); return $link; } else if ($type == "mysql") { if ($port) return mysqli_connect($host, $user, $pass, $db, $port); else return mysqli_connect($host, $user, $pass, $db); } } function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, $DB_PORT, $SELF_URL_PATH) { $data = explode("\n", file_get_contents("../config.php-dist")); $rv = ""; $finished = false; foreach ($data as $line) { if (preg_match("/define\('DB_TYPE'/", $line)) { $rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n"; } else if (preg_match("/define\('DB_HOST'/", $line)) { $rv .= "\tdefine('DB_HOST', '$DB_HOST');\n"; } else if (preg_match("/define\('DB_USER'/", $line)) { $rv .= "\tdefine('DB_USER', '$DB_USER');\n"; } else if (preg_match("/define\('DB_NAME'/", $line)) { $rv .= "\tdefine('DB_NAME', '$DB_NAME');\n"; } else if (preg_match("/define\('DB_PASS'/", $line)) { $rv .= "\tdefine('DB_PASS', '$DB_PASS');\n"; } else if (preg_match("/define\('DB_PORT'/", $line)) { $rv .= "\tdefine('DB_PORT', '$DB_PORT');\n"; } else if (preg_match("/define\('SELF_URL_PATH'/", $line)) { $rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n"; } else if (!$finished) { $rv .= "$line\n"; } if (preg_match("/\?\>/", $line)) { $finished = true; } } return $rv; } function db_query($link, $query, $type, $die_on_error = true) { if ($type == "pgsql") { $result = pg_query($link, $query); if (!$result) { $query = htmlspecialchars($query); // just in case if ($die_on_error) { die("Query $query failed [$result]: " . ($link ? pg_last_error($link) : "No connection")); } } return $result; } else if ($type == "mysql") { $result = mysqli_query($link, $query); if (!$result) { $query = htmlspecialchars($query); if ($die_on_error) { die("Query $query failed: " . ($link ? mysqli_error($link) : "No connection")); } } return $result; } } function make_self_url_path() { $url_path = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") ? 'http://' : 'https://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); return $url_path; } ?>
Tiny Tiny RSS Installer
Database settings
Database type
Username
Password
Database name
Host name If needed
Port 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.
Tiny Tiny RSS URL

Checking configuration
0) { print "

Some configuration tests failed. Please correct them before continuing.
"; print "

    "; foreach ($errors as $error) { print "
    $error
    "; } 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 (count($notices) > 0) { print_notice("Configuration check succeeded with minor problems:"); print "

    "; foreach ($notices as $notice) { print "
    $notice
    "; } 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.

   

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) { db_query($link, $line, $DB_TYPE); } } 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 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."); } } ?>



I really don't know where to look at ? does ttrss support php7 ? Should I sue an older version ?
Where do I go wrong ? or this a know issue ?

Any help very much apreciated. I'm impatient to use ttrss.
Thank you

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: Unable to make TTRSS work : PHP errors

Postby sleeper_service » 30 Jan 2017, 21:07

why don't you try READING the error messages you've pasted here?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Unable to make TTRSS work : PHP errors

Postby fox » 30 Jan 2017, 21:10

looks like your php doesn't work properly, i mean it just dumps code to the output if i'm reading this right

maybe you should ask for help with getting php working on ubuntu forums first, then if you have problems specific to tt-rss, ask here

>I have created config.php (BTW it looks like it's missing the ?> at the end)

that is actually how it should be

chris777
Bear Rating Trainee
Bear Rating Trainee
Posts: 13
Joined: 30 Jan 2017, 20:37

Re: Unable to make TTRSS work : PHP errors

Postby chris777 » 30 Jan 2017, 23:19

sleeper_service wrote:why don't you try READING the error messages you've pasted here?


Hi, I did but sorry this wasn't explict just throwing some php code. I didn't know if it came from the application or php or....

fox wrote:looks like your php doesn't work properly, i mean it just dumps code to the output if i'm reading this right

maybe you should ask for help with getting php working on ubuntu forums first, then if you have problems specific to tt-rss, ask here

>I have created config.php (BTW it looks like it's missing the ?> at the end)

that is actually how it should be


Thank you very much for your prompt reply.
In fact it was missing the php module for apache (libapache2-mod-php7.0)

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: Unable to make TTRSS work : PHP errors

Postby sleeper_service » 31 Jan 2017, 05:51

is it just me, or does it look like OP just created .... not copied and edited.... a seven line config.php file?

chris777
Bear Rating Trainee
Bear Rating Trainee
Posts: 13
Joined: 30 Jan 2017, 20:37

Re: Unable to make TTRSS work : PHP errors

Postby chris777 » 31 Jan 2017, 09:42

sleeper_service wrote:is it just me, or does it look like OP just created .... not copied and edited.... a seven line config.php file?


No I copied from the template and only changed these 7 lines.

BTW so far so good, I'm starting playing with ttrss.

darknite323
Bear Rating Trainee
Bear Rating Trainee
Posts: 40
Joined: 30 Oct 2013, 15:46

Re: Unable to make TTRSS work : PHP errors

Postby darknite323 » 31 Jan 2017, 10:48

This is why I always recommend people test any new system they setup, before trying to install anything else.

If you had just tried the most basic test, such as creating a phpinfo page (quite literally one line of code), you would have found that your setup was wrong and could actually take your issue to the right people.

For anyone interested, just put this in a .php file on your webserver and access it:

Code: Select all

<?php phpinfo(); ?>


Also please don't leave it there accessible to the outside world, at least lock it down or delete it when you are done.


Return to “Support”

Who is online

Users browsing this forum: No registered users and 7 guests