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

command not (always?) available in shell_exec #613

Open
divinity76 opened this issue Mar 19, 2024 · 1 comment
Open

command not (always?) available in shell_exec #613

divinity76 opened this issue Mar 19, 2024 · 1 comment

Comments

@divinity76
Copy link
Contributor

testing with php8.3 on ubuntu24.04-beta, command is not available in shell_exec:

hans@DESKTOP-EE15SLU:~/projects/headless-chomium-recorder$ command -v google-chrome chromium-browser chrome chromium
/usr/bin/chromium-browser
/snap/bin/chromium
hans@DESKTOP-EE15SLU:~/projects/headless-chomium-recorder$ php -r 'var_dump(shell_exec("command -v google-chrome chromium-browser chrome chromium"));'
Command line code:1:
NULL
hans@DESKTOP-EE15SLU:~/projects/headless-chomium-recorder$ php -r 'var_dump(shell_exec("bash -c '\''command -v google-chrome chromium-browser chr
ome chromium'\''"));'
Command line code:1:
string(45) "/usr/bin/chromium-browser
/snap/bin/chromium
"
hans@DESKTOP-EE15SLU:~/projects/headless-chomium-recorder$ php -r 'var_dump(shell_exec("which google-chrome chromium-browser chrome chromium"));'
Command line code:1:
string(45) "/usr/bin/chromium-browser
/snap/bin/chromium
"
hans@DESKTOP-EE15SLU:~/projects/headless-chomium-recorder$ 

PHP8.3 migrated some execution commands from fork+exec to posix_spawn, this might be another side-effect?

either way, seems our alternatives are to migrate to type (...) or bash -c 'command -v (...)' or implement our own getenv("PATH")-scanner (or just find one in composer) 🤔

this breaks chrome/chromium path autodetect in BrowserFactory

divinity76 added a commit to divinity76/chrome that referenced this issue Mar 19, 2024
command is not always available in shell_exec()
see chrome-php#613 for details
@divinity76
Copy link
Contributor Author

proposed fix: #614
(manual PATH scanner)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant