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

Improve detection of cgi in cli multi #15283

Closed
wants to merge 1 commit into from
Closed

Improve detection of cgi in cli multi #15283

wants to merge 1 commit into from

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 18, 2019

Not sure if it's possible but maybe a regular request is not using CGI, but then the CLI request is if findPhpBinary returns a cgi script?

See https://www.php.net/manual/en/function.shell-exec.php
In Matomo for WordPress seeing various reports where the output starts with #!/usr/bin/env php.

image

refs #15277
refs matomo-org/matomo-for-wordpress#135 (comment)

Trying to reproduce this locally this happens:

php -r "echo shell_exec(\"php-cgi app/console climulti:request -q  'module=API&method=API.get&idSite=1&period=day&date=last19&format=php&trigger=archivephp' --superuser\");"
X-Powered-By: PHP/7.3.12
Content-type: text/html; charset=UTF-8

Where it prints x-powered by etc

Not sure if it's possible but maybe a regular request is not using CGI, but then the CLI request is if `findPhpBinary` returns a cgi script?
@tsteur tsteur added the Needs Review PRs that need a code review label Dec 18, 2019
@tsteur tsteur added this to the 3.13.1 milestone Dec 18, 2019
@tsteur
Copy link
Member Author

tsteur commented Dec 18, 2019

just seeing this should be already done in https://github.com/matomo-org/matomo/blob/3.x-dev/core/CliMulti/CliPhp.php#L79-L84 ...

@tsteur tsteur closed this Dec 18, 2019
@tsteur tsteur deleted the cgi branch December 18, 2019 19:51
tsteur added a commit that referenced this pull request Dec 18, 2019
replaces #15283

Noticed the user's instance was using listespeed https://www.php.net/manual/en/install.unix.litespeed.php which returned following

``` 
phpbinary: /usr/local/bin/lsphp
phpbindir: /opt/alt/php72/usr/bin
which php: /usr/local/bin/php
```

We would have used lsphp but this seems to print the hashbang and have other issues. see #15283
diosmosis pushed a commit that referenced this pull request Dec 22, 2019
replaces #15283

Noticed the user's instance was using listespeed https://www.php.net/manual/en/install.unix.litespeed.php which returned following

``` 
phpbinary: /usr/local/bin/lsphp
phpbindir: /opt/alt/php72/usr/bin
which php: /usr/local/bin/php
```

We would have used lsphp but this seems to print the hashbang and have other issues. see #15283
jonasgrilleres pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 22, 2020
replaces matomo-org#15283

Noticed the user's instance was using listespeed https://www.php.net/manual/en/install.unix.litespeed.php which returned following

``` 
phpbinary: /usr/local/bin/lsphp
phpbindir: /opt/alt/php72/usr/bin
which php: /usr/local/bin/php
```

We would have used lsphp but this seems to print the hashbang and have other issues. see matomo-org#15283
jbuget pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 26, 2020
replaces matomo-org#15283

Noticed the user's instance was using listespeed https://www.php.net/manual/en/install.unix.litespeed.php which returned following

``` 
phpbinary: /usr/local/bin/lsphp
phpbindir: /opt/alt/php72/usr/bin
which php: /usr/local/bin/php
```

We would have used lsphp but this seems to print the hashbang and have other issues. see matomo-org#15283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant