@anonymous-piwik-user opened this Issue on March 10th 2014

Since 5 days, my piwik import_logs.py do nothing.
See the following error.

root<a class='mention' href='https://github.com/s15879177'>@s15879177</a>:~# python /var/www/tools/piwik/misc/log-analytics/import_logs.py --url=https://mywebsite/piwik/ --idsite=1 --show-progress --recorders=4 --enable-reverse-dns --useragent-exclude=oui-moi-cmoi --exclude-path=/robots.txt --exclude-path=/ubuntu/* --exclude-path=/public/ubuntu/* --exclude-path=*.svg.php /var/log/lighttpd/access.log.6.gz
Traceback (most recent call last):
  File "/var/www/tools/piwik/misc/log-analytics/import_logs.py", line 1722, in <module>
    config = Configuration()
  File "/var/www/tools/piwik/misc/log-analytics/import_logs.py", line 570, in __init__
    self._parse_args(self._create_parser())
  File "/var/www/tools/piwik/misc/log-analytics/import_logs.py", line 560, in _parse_args
    self.options.piwik_token_auth = self._get_token_auth()
  File "/var/www/tools/piwik/misc/log-analytics/import_logs.py", line 607, in _get_token_auth
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
@anonymous-piwik-user commented on March 10th 2014

I'm using Piwik 2.1.0.

Ok!

The problems come from the php command (line 603): command = updatetokenfile
My system does not has php command, but has php-cgi command.

@mattab commented on March 16th 2014 Owner

Thanks for the bug report!

What is the result of "which php" on your system?

Maybe we could use this command to find out which php to use.

@anonymous-piwik-user commented on March 16th 2014

Command which php return nothing:

root<a class='mention' href='https://github.com/s15879177'>@s15879177</a>:~# which php
root<a class='mention' href='https://github.com/s15879177'>@s15879177</a>:~# which php-cgi
/usr/bin/php-cgi

I'm using lighttpd 1.4.33 and php 5.5.9 on Debian testing.
But I don't know why php-cgi doesn't work since few weeks:

root<a class='mention' href='https://github.com/s15879177'>@s15879177</a>:~# php-cgi -v
Sun Mar 16 10:47:35 2014 (3293): Fatal Error Unable to allocate shared memory segment of 67108864 bytes: mmap: Cannot allocate memory (12)
@anonymous-piwik-user commented on April 8th 2014

I am having a very similar problem but not sure if exactly the same because my line numbers are a tad different. I am using apache to pipe its output to the import_logs.py file. After reading above I discovered that in my environment php is located at /usr/local/bin/php but the script is running as root which does not have that directory in its path. To fix this for myself I inserted a line in the import_logs.py file which I listed below. I know this is only a fix for my environment but just thought I'd let you know about this bug.

= My Fix

I added this line to import_logs.py towards the top after the "import" section.

os.environ["PATH"] = os.environ["PATH"] + ":/usr/local/bin"

= Error Output

Traceback (most recent call last):
  File "/hwnet/dtg_devel/web/boarddev/applications/piwik/misc/log-analytics/import_logs.py", line 1718, in <module>
    config = Configuration()
  File "/hwnet/dtg_devel/web/boarddev/applications/piwik/misc/log-analytics/import_logs.py", line 570, in __init__
    self._parse_args(self._create_parser())
  File "/hwnet/dtg_devel/web/boarddev/applications/piwik/misc/log-analytics/import_logs.py", line 560, in _parse_args
    self.options.piwik_token_auth = self._get_token_auth()
  File "/hwnet/dtg_devel/web/boarddev/applications/piwik/misc/log-analytics/import_logs.py", line 607, in _get_token_auth
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib64/python2.6/subprocess.py", line 639, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.6/subprocess.py", line 1228, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

= Configuration

Piwik: 2.1.0
Python: 2.6.6
PHP: 5.5.10
@scholtzmi commented on September 22nd 2014

Hello together,
are there any fixes for that Problem? I am using Piwik 2.6.1 and have a similar error output.

Traceback (most recent call last):
  File "import_logs.py", line 1768, in <module>
    config = Configuration()
  File "import_logs.py", line 581, in __init__
    self._parse_args(self._create_parser())
  File "import_logs.py", line 571, in _parse_args
    self.options.piwik_token_auth = self._get_token_auth()
  File "import_logs.py", line 662, in _get_token_auth
    credentials = open(filename, 'r').readline()
IOError: [Errno 2] No such file or directory: 'X-Powered-By: PHP/5.4.16\r\nContent-type: text/html\r\n\r\n/<my directory>/piwik/tmp/cache/token.php   
@mattab commented on March 12th 2015 Owner

Issue was moved to the new repository for Piwik Log Analytics: https://github.com/piwik/piwik-log-analytics/issues

refs #7163

This Issue was closed on March 12th 2015
Powered by GitHub Issue Mirror