magento / magento/magento2-functional-testing-framework
command.php: PHP_BINDIR fails on Magento Cloud - should be configurable via .env
- Dominant language
- PHP
- Stars
- 154
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
### Preconditions
1. Magento 2.4.7 on Adobe Commerce Cloud
2. MFTF 4.7.5
3. Running tests from local against cloud environment
4. Tests use `` actions
### Steps to reproduce
1. Deploy to Adobe Commerce Cloud
2. Run `vendor/bin/mftf build:project`
3. Run `vendor/bin/mftf doctor` or any test with `` action
### Expected result
Magento CLI commands execute successfully via `command.php` endpoint.
### Actual result
HTTP 403: "Given command not found valid in Magento CLI Command list."
**Root cause**: Line 22 in `command.php`:
```php
$php = PHP_BINDIR ? PHP_BINDIR . '/php' : 'php';
```
On Magento Cloud, PHP_BINDIR points to /usr/bin/php which is an incompatible PHP version. The correct PHP 8.3 is available via php in PATH, but the code never falls back to it because PHP_BINDIR is always set.
This is similar to issue #216 (PHP-FPM), which was fixed in PR #217 by switching from PHP_BINARY to PHP_BINDIR. That fixed PHP-FPM but broke Magento Cloud.
Simple fix: Make the PHP binary configurable in .env:
```php
$php = $_ENV['MFTF_PHP_BINARY'] ?? (PHP_BINDIR ? PHP_BINDIR . '/php' : 'php');
```
Then users can set MFTF_PHP_BINARY=php in .env for cloud environments.
Currently, we have to manually edit the file after every build:project, which isn't sustainable.
Contributor guide
Research direction
The issue identifies command.php at line 22; inspect how the PHP executable is selected and how .env values are loaded. Reproduce with vendor/bin/mftf build:project and vendor/bin/mftf doctor, then verify that MFTF_PHP_BINARY can select the PATH-provided PHP binary without breaking the default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100