Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core:archive errors: shell_exec(): Unable to execute 'which 'ps' 2> /dev/null #6222

Closed
multiformeingegno opened this issue Sep 15, 2014 · 8 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@multiformeingegno
Copy link

Is this related to memory? It's strange though, I have about 1GB free. And these are only the reports for one day.

PHP Warning:  shell_exec(): Unable to execute 'ps ex | awk '{print $1}'' in /var/www/default/piwik/core/CliMulti/Process.php on line 128
ERROR CoreConsole[2014-09-15 22:35:16] [acbde] Got invalid response from API request: http://XXXXXXXXXXX/piwik/index.php?module=API&method=API.get&idSite=4&period=month&date=last4&format=php&token_auth=XXXXXXXXXXX&trigger=archivephp. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.
PHP Warning:  shell_exec(): Unable to execute 'which 'ps' 2> /dev/null' in /var/www/default/piwik/core/CliMulti/Process.php on line 195
ERROR CoreConsole[2014-09-15 22:35:39] [acbde] Error unserializing the following response from http://XXXXXXXXX/piwik/index.php?module=API&method=API.get&idSite=4&period=year&date=last4&format=php&token_auth=XXXXXXXXX&trigger=archivephp: <html>
 <head><title>502 Bad Gateway</title></head>
 <body bgcolor="white">
 <center><h1>502 Bad Gateway</h1></center>
 <hr><center>nginx</center>
 </body>
 </html>
PHP Warning:  shell_exec(): Unable to execute 'which 'ps' 2> /dev/null' in /var/www/default/piwik/core/CliMulti/Process.php on line 195
PHP Warning:  shell_exec(): Unable to execute 'ps ex | awk '{print $1}'' in /var/www/default/piwik/core/CliMulti/Process.php on line 128
ERROR CoreConsole[2014-09-15 22:36:57] [acbde] Got invalid response from API request: http://XXXXXXXXXXX/piwik/index.php?module=API&method=API.get&idSite=9&period=year&date=last2&format=php&token_auth=XXXXXXXXX&trigger=archivephp. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.
PHP Warning:  shell_exec(): Unable to execute 'which 'ps' 2> /dev/null' in /var/www/default/piwik/core/CliMulti/Process.php on line 195
ERROR CoreConsole[2014-09-15 22:37:11] [acbde] Got invalid response from API request: http://XXXXXXXX/piwik/index.php?module=API&method=API.get&idSite=10&period=day&date=last52&format=php&token_auth=XXXXXXXXXXXXX&trigger=archivephp. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.
ERROR CoreConsole[2014-09-15 22:37:11] [acbde] Empty or invalid response '' for website id 10, Time elapsed: 9.046s, skipping
PHP Warning:  shell_exec(): Unable to execute 'which 'ps' 2> /dev/null' in /var/www/default/piwik/core/CliMulti/Process.php on line 195
PHP Warning:  shell_exec(): Unable to execute 'which 'ps' 2> /dev/null' in /var/www/default/piwik/core/CliMulti/Process.php on line 195
ERROR CoreConsole[2014-09-15 22:39:39] [acbde] 5 total errors during this script execution, please investigate and try and fix these errors.

PHP 5.5.14
nginx 1.7.4

@ThaDafinser
Copy link
Contributor

@multiformeingegno i had a similar issue. It's maybe nothing about memory (the error message is not the best).
#315
http://stackoverflow.com/questions/11471739/shell-exec-error-when-executing-php-script

@multiformeingegno
Copy link
Author

Unfortunately I'm already using the full path to call php. The strange thing is the errors appear after some websites have been archived successfully..!

On Tue, Sep 16, 2014 at 8:40 AM, Martin Keckeis notifications@github.com
wrote:

@multiformeingegno i had a similar issue. It's maybe nothing about memory (the error message is not the best).
#315

http://stackoverflow.com/questions/11471739/shell-exec-error-when-executing-php-script

Reply to this email directly or view it on GitHub:
#6222 (comment)

@mattab
Copy link
Member

mattab commented Sep 17, 2014

@multiformeingegno if you type in your Shell in Piwik server the command ps ex | awk '{print $1}' what result do you see?

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 17, 2014
@mattab mattab added this to the Short term milestone Sep 17, 2014
@multiformeingegno
Copy link
Author

PID
1
2
3
5
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
27
28
29
30
31
32
33
45
47
48
68
69
120
121
122
426
432
434
437
741
1191
1195
1200
1201
1204
1235
1240
1303
1439
1512
1535
1721
2402
6120
6122
6208
7238
8332
8380
8450
8496
8544
8568
8616
8634
8635
10135
10136
11828
11831
11899
29706
29740

@mattab
Copy link
Member

mattab commented Sep 17, 2014

it works here but not from php... At the same time there was the 502 gateway error which is maybe just the server running out of memory or similar (processing the last years). if you run core:archive today can you reproduce some errors and and if so post here the full error and backtrace if you see any? Maybe you can add in config:

[log] 
; logs to tmp/logs/piwik.log
log_level=debug
log_writers[] = "file"

which maybe will give you backtrace if you don't get them by default. cheers

@multiformeingegno
Copy link
Author

/opt/php5/bin/php /var/www/default/piwik/console core:archive --url=http://xxxx/piwik/ > /var/log/piwik/log.log

PHP Warning:  shell_exec(): Unable to execute 'ps ex | awk '{print $1}'' in /var/www/default/piwik/core/CliMulti/Process.php on line 128

ERROR CoreConsole[2014-09-17 12:17:49] [68b73] Got invalid response from API request: http://xxxxxxx/piwik/index.php?module=API&method=API.get&idSite=4&period=month&date=last6&format=php&token_auth=xxxxxxx&trigger=archivephp. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.

PHP Warning:  shell_exec(): Unable to execute 'which 'ps' 2> /dev/null' in /var/www/default/piwik/core/CliMulti/Process.php on line 195

ERROR CoreConsole[2014-09-17 12:18:08] [68b73] Got invalid response from API request: http://xxxxx/piwik/index.php?module=API&method=API.get&idSite=4&period=year&date=last6&format=php&token_auth=xxxxx&trigger=archivephp.
Response was '<!DOCTYPE html> <html> <head>  <meta charset="utf-8">  <title>Piwik &rsaquo; Error</title>  <link rel="shortcut icon" href="plugins/CoreHome/images/favicon.ico" />  <link rel="stylesheet" type="text/css" href="plugins/Morpheus/stylesheets/simple_structure.css" /> </head> <body id="simple"> <div id="contentsimple">  <div id="title"><img title="Piwik" alt="Piwik" src="plugins/Morpheus/images/logo-header.png" style="margin-left:10px;" /><span id="subh1"> # <a href='http://piwik.org/'>Web Analytics</a></span></div> <p><p>Cannot connect to the database:</p>  <p><strong>SQLSTATE[HY000] [1135] Can&#039;t create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug</strong></p>  <p>This may be a temporary issue, try <a href="javascript:window.location.reload()">refreshing the page</a>. If the problem persists please contact your Piwik administrator.</p></p>                     <p><a href="index.php">Go to Piwik</a><br/>                        <a href="index.php?module=Login">Login</a></p>  </div> </body> </html>'

ERROR CoreConsole[2014-09-17 12:20:47] [68b73] 2 total errors during this script execution, please investigate and try and fix these errors.

@multiformeingegno
Copy link
Author

Other strange thing that maybe can help determining what's happening:
Now if I visit piwik/misc/cron/archive.php?token_auth=XXXXX from browser I get:

        <h1>A fatal error occurred</h1>

        <div style="width: 640px">

                    <p>
                The following error just broke Piwik (v2.6.1):
                <pre>Uncaught exception &#039;Exception&#039; with message &#039;Please check that the web server has enough permission to write to these files/directories:&lt;br /&gt;For example, on a GNU/Linux server if your Apache httpd user is www-data, you can try to execute:&lt;br /&gt;
&lt;code&gt;chown -R www-data:www-data /var/www/default/piwik/tmp/logs/piwik.log&lt;/code&gt;&lt;br /&gt;&lt;code&gt;chmod -R 0755 /var/www/default/piwik/tmp/logs/piwik.log&lt;/code&gt;&lt;br /&gt;&#039; in /var/www/default/piwik/core/Log.php:384
Stack trace:
#0 [internal function]: Piwik\Log-&gt;logToFile(1, false, &#039;2014-09-18 00:2...&#039;, &#039;Got invalid res...&#039;)
#1 /var/www/default/piwik/core/Log.php(449): call_user_func(Array, 1, false, &#039;2014-09-18 00:2...&#039;, &#039;Got invalid res...&#039;)
#2 /var/www/default/piwik/core/Log.php(443): Piwik\Log-&gt;writeMessage(1, false, &#039;2014-09-18 00:2...&#039;, &#039;Got invalid res...&#039;)
#3 /var/www/default/piwik/core/Log.php(463): Piwik\Log-&gt;doLog(1, &#039;Got invalid res...&#039;, Array)
#4 /var/www/default/piwik/core/Log.php(190): Piwik\Log::logMessage(1, &#039;Got invalid res...&#039;, Array)
#5 /var/www/default/piw</pre>
                in
                <pre>/var/www/default/piwik/core/Log.php line 384</pre>
            </p>

EDIT: I don't think this is related. I did a chmod 775 -R /var/www/default/piwik and now it works again..

@mattab mattab changed the title I always get errors when using core:archive core:archive errors: shell_exec(): Unable to execute 'which 'ps' 2> /dev/null Oct 12, 2014
@mattab
Copy link
Member

mattab commented Dec 1, 2014

@multiformeingegno in the Diagnosis > System check, do you see an error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants