update_daemon is unable to read config.php

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
mc-kay
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 10 Jun 2013, 02:29

update_daemon is unable to read config.php

Postby mc-kay » 10 Jun 2013, 02:53

Hello, update_daemon2 is always throwing errors and does not update feeds like this:

Code: Select all

┌─[[email protected]]
└──> sudo systemctl status tt-rss-updated
tt-rss-updated.service - Tiny tiny rss feed updater daemon
   Loaded: loaded (/etc/systemd/system/tt-rss-updated.service; disabled)
   Active: active (running) since Mon 2013-06-10 00:28:31 CEST; 4s ago
 Main PID: 6691 (php)
   CGroup: name=systemd:/system/tt-rss-updated.service
           └─6691 /usr/bin/php -c /etc/webapps/tt-rss/php.ini -d safe_mode=Off /usr/share/webapps/tt-rss/update_daemon2.php --quiet

Jun 10 00:28:31 Atlantis systemd[1]: Stopping Tiny tiny rss feed updater daemon...
Jun 10 00:28:31 Atlantis systemd[1]: Starting Tiny tiny rss feed updater daemon...
Jun 10 00:28:31 Atlantis systemd[1]: Started Tiny tiny rss feed updater daemon.
Jun 10 00:28:31 Atlantis php[6691]: PHP Warning:  require_once(): open_basedir restriction in effect. File(/etc/webapps/tt-rss/config.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/) in /usr/share/webapps/tt-rss/include/functions.php on line 23
Jun 10 00:28:31 Atlantis php[6691]: PHP Warning:  require_once(): open_basedir restriction in effect. File(/etc/webapps/tt-rss/config.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/) in /usr/share/webapps/tt-rss/include/functions.php on line 23
Jun 10 00:28:31 Atlantis php[6691]: PHP Warning:  require_once(/etc/webapps/tt-rss/config.php): failed to open stream: Operation not permitted in /usr/share/webapps/tt-rss/include/functions.php on line 23
Jun 10 00:28:31 Atlantis php[6691]: PHP Warning:  require_once(/etc/webapps/tt-rss/config.php): failed to open stream: Operation not permitted in /usr/share/webapps/tt-rss/include/functions.php on line 23
Jun 10 00:28:31 Atlantis php[6691]: PHP Fatal error:  require_once(): Failed opening required 'config.php' (include_path='/usr/share/webapps/tt-rss/include:.:/usr/share/pear') in /usr/share/webapps/tt-rss/include/functions.php on line 23
Jun 10 00:28:31 Atlantis php[6691]: PHP Fatal error:  require_once(): Failed opening required 'config.php' (include_path='/usr/share/webapps/tt-rss/include:.:/usr/share/pear') in /usr/share/webapps/tt-rss/include/functions.php on line 23

"/etc/webapps/tt-rss/php.ini" has "open_basedir = none" set so I dont get why he says "open_basedir restriction in effect".
"/usr/share/webapps/tt-rss/config.php" is a symlink to "/etc/webapps/tt-rss/config.php"
The "http" user where the deamon is running can also read the config, tested with "sudo -u http cat /usr/share/webapps/tt-rss/config.php"
File permissions:

Code: Select all

┌─[[email protected]]
└──> ls -l /etc/webapps/tt-rss
total 84
-rw-r--r-- 1 root http  7966 Jun 10 00:26 config.php
-rwxr-xr-x 1 root http  7980 May 28 17:44 config.php-dist
-rw-r--r-- 1 root root 66329 Jun 10 00:19 php.ini

┌─[[email protected]]
└──> ls -l /usr/share/webapps/tt-rss
total 264
drwxr-xr-x  2 root root  4096 May 13 11:34 api
-rw-r--r--  1 root root  1377 May 13 11:34 atom-to-html.xsl
-rw-r--r--  1 root root  3778 May 13 11:34 backend.php
lrwxrwxrwx  1 root root    21 May 28 17:44 cache -> /var/lib/tt-rss/cache
-rw-r--r--  1 root root  3225 May 13 11:34 cdm.css
drwxr-xr-x  8 root root  4096 May 13 11:34 classes
lrwxrwxrwx  1 root root    30 Jun 10 00:01 config.php -> /etc/webapps/tt-rss/config.php
-rw-r--r--  1 root root  7980 May 13 11:34 config.php-dist
-rw-r--r--  1 root root  1537 May 13 11:34 errors.php
lrwxrwxrwx  1 root root    26 May 28 17:44 feed-icons -> /var/lib/tt-rss/feed-icons
-rw-r--r--  1 root root  1318 May 13 11:34 image.php
drwxr-xr-x  2 root root  4096 May 13 11:34 images
drwxr-xr-x  2 root root  4096 May 13 11:34 include
-rw-r--r--  1 root root  9979 May 13 11:34 index.php
drwxr-xr-x  2 root root  4096 May 13 11:34 install2
drwxr-xr-x  2 root root  4096 May 13 11:34 js
drwxr-xr-x 13 root root  4096 May 13 11:34 lib
-rw-r--r--  1 root root 17987 May 13 11:34 LICENSE
drwxr-xr-x 19 root root  4096 May 13 11:34 locale
lrwxrwxrwx  1 root root    20 May 28 17:44 lock -> /var/lib/tt-rss/lock
-rw-r--r--  1 root root 70832 May 13 11:34 messages.pot
-rw-r--r--  1 root root   805 May 13 11:34 opml.php
drwxr-xr-x 25 root root  4096 May 13 11:34 plugins
-rw-r--r--  1 root root  2488 May 13 11:34 prefs.css
-rw-r--r--  1 root root  4569 May 13 11:34 prefs.php
-rw-r--r--  1 root root  1510 May 13 11:34 public.php
-rw-r--r--  1 root root   754 May 13 11:34 README.md
-rw-r--r--  1 root root 10223 May 13 11:34 register.php
drwxr-xr-x  3 root root  4096 May 13 11:34 schema
drwxr-xr-x  2 root root  4096 May 13 11:34 templates
drwxr-xr-x  2 root root  4096 May 13 11:34 themes
-rw-r--r--  1 root root 16643 May 13 11:34 tt-rss.css
-rwxr-xr-x  1 root root  5840 May 13 11:34 update_daemon2.php
-rwxr-xr-x  1 root root  9502 May 13 11:34 update.php
-rw-r--r--  1 root root  3765 May 13 11:34 utility.css
drwxr-xr-x  2 root root  4096 May 13 11:34 utils

The web interface is also running fine (except the feed updates).
Host system is ArchLinux using tt-rss 1.7.9.

Does someone have an idea what the hell is going wrong here?

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

Re: update_daemon is unable to read config.php

Postby sleeper_service » 10 Jun 2013, 09:19

mc-kay wrote:Hello, update_daemon2 is always throwing errors and does not update feeds like this:

Code: Select all

Jun 10 00:28:31 Atlantis php[6691]: PHP Warning:  require_once(): open_basedir restriction in effect. File(/etc/webapps/tt-rss/config.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/) in /usr/share/webapps/tt-rss/include/functions.php on line 23


Does someone have an idea what the hell is going wrong here?


misconfigured php.

lotrfan
Bear Rating Disaster
Bear Rating Disaster
Posts: 73
Joined: 18 Mar 2013, 04:42

Re: update_daemon is unable to read config.php

Postby lotrfan » 10 Jun 2013, 11:05

sleeper_service wrote:
mc-kay wrote:Hello, update_daemon2 is always throwing errors and does not update feeds like this:

Code: Select all

Jun 10 00:28:31 Atlantis php[6691]: PHP Warning:  require_once(): open_basedir restriction in effect. File(/etc/webapps/tt-rss/config.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/) in /usr/share/webapps/tt-rss/include/functions.php on line 23


Does someone have an idea what the hell is going wrong here?


misconfigured php.


In "open_basedir = none" (in php.ini), I think 'None' should be capitalized, e.g.,

Code: Select all

open_basedir = None

You can also just leave it blank, e.g.,

Code: Select all

open_basedir =


If you're putting it in your httpd.conf, it should be

Code: Select all

php_admin_value open_basedir "none"

reibuehl
Bear Rating Trainee
Bear Rating Trainee
Posts: 25
Joined: 17 May 2013, 19:37

Re: update_daemon is unable to read config.php

Postby reibuehl » 10 Jun 2013, 11:19

Some linux distributions use a different php.ini for command line invocations. In Debian for example the one in /etc/php5/cli/ is used.

mc-kay
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 10 Jun 2013, 02:29

Re: update_daemon is unable to read config.php

Postby mc-kay » 10 Jun 2013, 11:53

@lotrfan: I tried all combinations but everything with the same result.
@reibuehl: Shouldn't "/usr/bin/php -c /etc/webapps/tt-rss/php.ini" specify the ini file to use?

reibuehl
Bear Rating Trainee
Bear Rating Trainee
Posts: 25
Joined: 17 May 2013, 19:37

Re: update_daemon is unable to read config.php

Postby reibuehl » 10 Jun 2013, 13:37

I just noticed that I had to do changes in /etc/php5/apache/php.ini and /etc/php5/cli/php.ini to get my environment running. I don't know enough about php to say if specifying a separate config file will overrule settings in the other files, sorry.

lotrfan
Bear Rating Disaster
Bear Rating Disaster
Posts: 73
Joined: 18 Mar 2013, 04:42

Re: update_daemon is unable to read config.php

Postby lotrfan » 10 Jun 2013, 20:04

mc-kay wrote:@lotrfan: I tried all combinations but everything with the same result.

It was worth a shot...

mc-kay wrote:@reibuehl: Shouldn't "/usr/bin/php -c /etc/webapps/tt-rss/php.ini" specify the ini file to use?


edit: You probably don't want to use this method, as it doesn't look like fox will accept the patch (i.e., you'll have to patch each and every update). See my alternative methods below.

Try applying the patch below. This should (in theory) resolve the issue mentioned on the Arch Wiki

Code: Select all

 
diff --git a/update.php b/update.php
index ff6b825..8dd493e 100755
--- a/update.php
+++ b/update.php
@@ -162,8 +162,9 @@
    if (isset($options["daemon"])) {
       while (true) {
          $quiet = (isset($options["quiet"])) ? "--quiet" : "";
+         $phpini = get_cfg_var('cfg_file_path');
 
-         passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet");
+         passthru(PHP_EXECUTABLE . " " . ($phpini ? "-c \"${phpini}\" " : "") . $argv[0] ." --daemon-loop $quiet");
          _debug("Sleeping for " . DAEMON_SLEEP_INTERVAL . " seconds...");
          sleep(DAEMON_SLEEP_INTERVAL);
       }
diff --git a/update_daemon2.php b/update_daemon2.php
index 9d948a6..cc7faec 100755
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -221,7 +221,9 @@
 
                $my_pid = posix_getpid();
 
-               passthru(PHP_EXECUTABLE . " update.php --daemon-loop $quiet --task $j --pidlock $my_pid");
+               $phpini = get_cfg_var('cfg_file_path');
+
+               passthru(PHP_EXECUTABLE . ($phpini ? " -c \"${phpini}\"" : "") " update.php --daemon-loop $quiet --task $j --pidlock $my_pid");
 
                sleep(1);
 

Let me know if it works... If it does I'll send fox a pull request.
Last edited by lotrfan on 10 Jun 2013, 20:31, edited 1 time in total.

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

Re: update_daemon is unable to read config.php

Postby fox » 10 Jun 2013, 20:13

Please don't.

lotrfan
Bear Rating Disaster
Bear Rating Disaster
Posts: 73
Joined: 18 Mar 2013, 04:42

Re: update_daemon is unable to read config.php

Postby lotrfan » 10 Jun 2013, 20:29

If you don't want to keep patching each new version (it doesn't sound like fox will accept the patch), there are a few other options:
  • You might be able to add the "-c /path/to/php.ini" to 'PHP_EXECUTABLE' (in config.php)... This is probably a Bad Idea.
  • Just use the system php.ini and add the directory in /etc to it, e.g.

    Code: Select all

    open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/
The second method is probably the easiest, and also the least likely to break in the future.

mc-kay
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 10 Jun 2013, 02:29

Re: update_daemon is unable to read config.php

Postby mc-kay » 11 Jun 2013, 00:50

@ lotrfan: I added the directory like you said but now I getting this error when starting the deamon:

Code: Select all

┌─[[email protected]]
└──> sudo systemctl status tt-rss-updated
tt-rss-updated.service - Tiny tiny rss feed updater daemon
   Loaded: loaded (/etc/systemd/system/tt-rss-updated.service; disabled)
   Active: failed (Result: exit-code) since Mon 2013-06-10 22:44:07 CEST; 15s ago
  Process: 8473 ExecStart=/usr/bin/php -d safe_mode=Off /usr/share/webapps/tt-rss/update_daemon2.php --quiet (code=exited, status=255)

Jun 10 22:44:07 Atlantis php[8473]: Please fix errors indicated by the following messages:
Jun 10 22:44:07 Atlantis php[8473]: * Image cache is not writable (chmod -R 777 cache/images)
Jun 10 22:44:07 Atlantis php[8473]: * Upload cache is not writable (chmod -R 777 cache/upload)
Jun 10 22:44:07 Atlantis php[8473]: * Data export cache is not writable (chmod -R 777 cache/export)
Jun 10 22:44:07 Atlantis php[8473]: * Javascript cache is not writable (chmod -R 777 cache/js)
Jun 10 22:44:07 Atlantis php[8473]: * ICONS_DIR defined in config.php is not writable (chmod -R 777 feed-icons).
Jun 10 22:44:07 Atlantis php[8473]: * LOCK_DIRECTORY defined in config.php is not writable (chmod -R 777 lock).
Jun 10 22:44:07 Atlantis php[8473]: You might want to check tt-rss wiki or the forums for more information.
Jun 10 22:44:07 Atlantis systemd[1]: tt-rss-updated.service: main process exited, code=exited, status=255/n/a
Jun 10 22:44:07 Atlantis systemd[1]: Unit tt-rss-updated.service entered failed state.

I setted "chmod -R 777" to all this directory's but with no result.

lotrfan
Bear Rating Disaster
Bear Rating Disaster
Posts: 73
Joined: 18 Mar 2013, 04:42

Re: update_daemon is unable to read config.php

Postby lotrfan » 11 Jun 2013, 20:07

Right... Arch's tt-rss package likes to spread things out:

Code: Select all

$ pacman -Ql tt-rss
tt-rss /etc/
tt-rss /etc/webapps/
tt-rss /etc/webapps/tt-rss/
tt-rss /etc/webapps/tt-rss/config.php-dist
tt-rss /usr/
tt-rss /usr/lib/
tt-rss /usr/lib/systemd/
tt-rss /usr/lib/systemd/system/
tt-rss /usr/lib/systemd/system/tt-rss.service
tt-rss /usr/share/
tt-rss /usr/share/webapps/
tt-rss /usr/share/webapps/tt-rss/
tt-rss /usr/share/webapps/tt-rss/LICENSE
tt-rss /usr/share/webapps/tt-rss/README.md
[...snip...]
tt-rss /usr/share/webapps/tt-rss/utils/update-translations.sh
tt-rss /var/
tt-rss /var/lib/
tt-rss /var/lib/tt-rss/
tt-rss /var/lib/tt-rss/cache/
tt-rss /var/lib/tt-rss/cache/.htaccess
[...snip...]
tt-rss /var/lib/tt-rss/lock/
tt-rss /var/lib/tt-rss/lock/.empty
tt-rss /var/lib/tt-rss/lock/.htaccess

(It puts the more "variable" files in /var/lib/tt-rss, with symlinks in /usr/share/webapps/tt-rss)

Try adding /var/lib/tt-rss/ to the open_basedir setting (in the system php.ini), or set the system's open_basedir = None.

rwd
Bear Rating Trainee
Bear Rating Trainee
Posts: 27
Joined: 21 Apr 2013, 14:52

Re: update_daemon is unable to read config.php

Postby rwd » 11 Jun 2013, 21:28

This question seems package specific. Ask the Arch package maintainer. Or use the source/git version from tt-rss.org which keeps all files together the same subfolder (making permission issues easier to fix).

mc-kay
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 10 Jun 2013, 02:29

Re: update_daemon is unable to read config.php

Postby mc-kay » 12 Jun 2013, 01:31

lotrfan wrote:Try adding /var/lib/tt-rss/ to the open_basedir setting (in the system php.ini), or set the system's open_basedir = None.

Yea, adding "/var/lib/tt-rss/" to open_basedir finally got the daemon to work.
Thanks a lot :D

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

Re: update_daemon is unable to read config.php

Postby sleeper_service » 12 Jun 2013, 05:20

mc-kay wrote:
lotrfan wrote:Try adding /var/lib/tt-rss/ to the open_basedir setting (in the system php.ini), or set the system's open_basedir = None.

Yea, adding "/var/lib/tt-rss/" to open_basedir finally got the daemon to work.
Thanks a lot :D

*makes note* archlinux is all kinds of fucked up.

lotrfan
Bear Rating Disaster
Bear Rating Disaster
Posts: 73
Joined: 18 Mar 2013, 04:42

Re: update_daemon is unable to read config.php

Postby lotrfan » 12 Jun 2013, 12:26

sleeper_service wrote:
mc-kay wrote:
lotrfan wrote:Try adding /var/lib/tt-rss/ to the open_basedir setting (in the system php.ini), or set the system's open_basedir = None.

Yea, adding "/var/lib/tt-rss/" to open_basedir finally got the daemon to work.
Thanks a lot :D

*makes note* archlinux is all kinds of fucked up.

Some of the packages are... I got fed up with running the packaged version (although I don't remember it being a pain to configure) when I wanted to start patching things. Trunk just fine on Arch, though :)


Return to “Support”

Who is online

Users browsing this forum: No registered users and 9 guests