{"record":{"id":"56196879ddbf213b","repo":"oraios/serena","slug":"php-major-minor-detected-but-phpactor-require","errorCode":null,"errorMessage":"PHP {major}.{minor} detected, but Phpactor requires PHP 8.1+. Please upgrade PHP.","messagePattern":"PHP (.+?)\\.(.+?) detected, but Phpactor requires PHP 8\\.1\\+\\. Please upgrade PHP\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/phpactor.py","lineNumber":78,"sourceCode":"            Setup runtime dependencies for Phpactor and return the path to the PHAR file.\n            \"\"\"\n            phpactor_version = self._custom_settings.get(\"phpactor_version\", DEFAULT_PHPACTOR_VERSION)\n            phpactor_phar_url = f\"https://github.com/phpactor/phpactor/releases/download/{phpactor_version}/phpactor.phar\"\n            # Verify PHP is installed\n            php_path = shutil.which(\"php\")\n            assert php_path is not None, (\n                \"PHP is not installed or not found in PATH. Phpactor requires PHP 8.1+. Please install PHP and try again.\"\n            )\n\n            # Check PHP version (Phpactor requires PHP 8.1+)\n            result = subprocess_run([\"php\", \"--version\"], capture_output=True, text=True, check=False)\n            php_version_output = result.stdout.strip()\n            log.info(f\"PHP version: {php_version_output}\")\n            version_match = re.search(r\"PHP (\\d+)\\.(\\d+)\", php_version_output)\n            if version_match:\n                major, minor = int(version_match.group(1)), int(version_match.group(2))\n                if major < 8 or (major == 8 and minor < 1):\n                    raise RuntimeError(f\"PHP {major}.{minor} detected, but Phpactor requires PHP 8.1+. Please upgrade PHP.\")\n            else:\n                log.warning(\"Could not parse PHP version from output. Continuing anyway.\")\n\n            # legacy unversioned phar at root reserved for INITIAL; every other version goes into a versioned subdir\n            if phpactor_version == INITIAL_PHPACTOR_VERSION:\n                phar_dir = self._ls_resources_dir\n            else:\n                phar_dir = os.path.join(self._ls_resources_dir, f\"phpactor-{phpactor_version}\")\n            phpactor_phar_path = os.path.join(phar_dir, \"phpactor.phar\")\n            if not os.path.exists(phpactor_phar_path):\n                os.makedirs(phar_dir, exist_ok=True)\n                log.info(f\"Downloading phpactor PHAR from {phpactor_phar_url}\")\n                FileUtils.download_and_extract_archive_verified(\n                    phpactor_phar_url,\n                    phpactor_phar_path,\n                    \"binary\",\n                    expected_sha256=_phpactor_sha(phpactor_version),\n                    allowed_hosts=PHPACTOR_ALLOWED_HOSTS,","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/phpactor.py#L60-L96","documentation":"Raised by Phpactor's _get_or_install_core_dependency when the detected PHP runtime version (parsed from `php -v` output via /PHP (\\d+)\\.(\\d+)/) is below 8.1. Phpactor requires PHP 8.1 or newer, so the library refuses to proceed rather than fail later with cryptic errors.","triggerScenarios":"Instantiating the Phpactor-based PHP language server when the php binary on PATH reports e.g. PHP 7.4 or 8.0; the parsed major.minor < 8.1 triggers the error. If the version string can't be parsed at all, it only logs a warning and continues.","commonSituations":"Old system PHP on Ubuntu 20.04/Debian (7.4); multiple PHP versions installed with an older one first on PATH; macOS stock PHP or old Homebrew PHP; CI images pinned to PHP 7.x; XAMPP/MAMP shipping PHP < 8.1.","solutions":["Upgrade PHP to >= 8.1 (e.g. on Debian/Ubuntu use the sury/ondrej PPA: `sudo apt install php8.2-cli`).","If multiple PHP versions exist, ensure a >= 8.1 binary comes first on PATH (adjust PATH or use update-alternatives / brew link php@8.2).","In CI, bump the setup-php action / Docker image to PHP 8.1+.","Verify with `php -v` in the same environment that launches the server before retrying."],"exampleFix":"// before (shell, Ubuntu 20.04)\nphp -v  # PHP 7.4.33\npython -m app  # RuntimeError\n// after\nsudo add-apt-repository ppa:ondrej/php\nsudo apt update && sudo apt install php8.2-cli\nsudo update-alternatives --set php /usr/bin/php8.2\nphp -v  # PHP 8.2.x\npython -m app","handlingStrategy":"validation","validationCode":"import re, subprocess\ndef php_meets_requirement(min_major=8, min_minor=1):\n    out = subprocess.run([\"php\", \"-v\"], capture_output=True, text=True).stdout\n    m = re.search(r\"PHP (\\d+)\\.(\\d+)\", out)\n    if not m:\n        return False\n    major, minor = int(m.group(1)), int(m.group(2))\n    return (major, minor) >= (min_major, min_minor)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin PHP >= 8.1 in CI (setup-php) and Docker base images (php:8.2-cli)","Ensure the correct php binary is first on PATH when multiple versions exist","Upgrade old system PHP via the sury PPA or distro upgrade","Check `php -v` in the launching environment before initializing the server"],"tags":["php","phpactor","version-requirement","upgrade"],"backgroundTag":"dependency-version-too-old","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}