php2shell_rescue

emergency php security updates for aging intel macs

php2shell_rescue
patch php on an intel mac that must continue to serve

By Steven Stromer, Oct 23, 2026

When critical PHP vulnerabilities collide with an aging MacBook Pro and Homebrew's diminishing support for Intel hardware, building your own upgrade utility begins to make a surprising amount of sense.

I have a 2017 MacBook Pro that has spent much of its retirement pretending it's a server. Over the years, this relatively modest little computer has acquired responsibility for hosting websites, managing databases, serving a substantial music collection, and supporting a variety of software development projects. It's not particularly fast, and its eight gigabytes of RAM won't impress anyone, but it does everything I ask of it. More importantly, I've invested an unreasonable amount of time making certain that it continues to do so.

Keeping an older Mac useful isn't always easy. Between Apple's diminishing operating-system support, increasingly demanding software dependencies, and the peculiarities of operating a laptop with its lid permanently closed, there have been plenty of opportunities to abandon the project. Nevertheless, I've managed to work around most of these difficulties, and I've developed a certain affection for the idea that a computer should remain useful until the hardware, rather than the software industry, decides otherwise.

On October 21, 2026, that philosophy encountered a rather serious challenge. The PHP development team announced emergency security releases addressing two critical vulnerabilities, collectively known as PHP2Shell. My server was running PHP 8.5.6, and its Apache configuration used mod_php, placing it squarely among the installations of greatest concern.

Updating to PHP 8.5.12 seemed straightforward enough. Unfortunately, several dependencies had become difficult or impossible to upgrade through Homebrew, which had already discouraged me from performing routine maintenance on this machine. When a critical security vulnerability is involved, doing nothing is no longer a particularly attractive maintenance strategy.

I wasn't particularly interested in allowing a single PHP exploit to bring an otherwise successful server project to an end. So, rather than replacing the computer or rebuilding the entire software environment, I decided to find another way to install the patched PHP release. The result was php2shell_rescue, a Python-based emergency upgrade utility intended to automate much of that work.

two vulnerabilities that couldn't wait

PHP2Shell encompasses CVE-2026-109618 and CVE-2026-109619, two memory-management vulnerabilities in PHP's core request handling. Both received CVSS 4.0 severity scores of 9.2, with the potential to allow unauthenticated attackers to execute arbitrary code on affected servers.

The first involves the handling of partially initialized internal structures during out-of-memory conditions. The second involves request-specific state that survives after its underlying memory has been released. Both create opportunities for memory corruption, and neither requires a vulnerability in the application being served. Of particular concern is that some attacks can occur before PHP executes any of the website's application code. Authentication routines, input validation, and the usual protections developers build into their applications may never have an opportunity to intervene.

The PHP project released four patched versions on October 21:

PHP branchSecurity release
8.58.5.12
8.48.4.27
8.38.3.36
8.28.2.35

Nor was this a vulnerability that administrators could safely leave on their weekend maintenance lists. Amazon's threat-intelligence team reported observing an exploitation attempt on October 17, four days before the public disclosure, followed by additional attempts surrounding the release.

The PHP development team was unusually direct in its recommendation: updating is the only complete remedy for these vulnerabilities. Temporary mitigations can reduce exposure, but they cannot eliminate every identified attack path. For administrators whose package managers were functioning normally, the appropriate response was to install the security update and verify it. For those maintaining older or less conventional systems, however, the prospect of a straightforward update was considerably less certain.

introducing php2shell_rescue

php2shell_rescue was developed around an installation that had already been successfully upgraded manually from PHP 8.5.6 to 8.5.12. That work established that a 2017 dual-core Intel MacBook Pro, running macOS Ventura 13.7.8, could compile PHP from the official sources, retain its required extensions, and load the replacement module under Apache. The new utility attempts to make that procedure repeatable.

Rather than invoke Homebrew to upgrade PHP and its entire dependency tree, it examines the existing installation, builds a compatible replacement against available libraries, and stages the results independently. Once the build has been validated, it can back up the Apache configuration, activate the replacement module, restart the appropriate Apache service, and verify the result through an actual HTTP request. If deployment fails, it attempts to restore the previous configuration and restart Apache using the original PHP module.

php2shell_rescue is currently a technical release candidate. Version 0.3.4 includes voluntary diagnostic reporting and has passed 26 automated tests covering deployment logic, rollback, diagnostic sanitization, and upgrade safeguards. The reporting receiver also passed local HTTP integration tests. These tests are not a substitute for real-world validation of the installer, which is now being offered for public beta testing.

The utility is intentionally limited to a well-defined class of systems:

  • Native Intel Macs using Homebrew Apache under /usr/local
  • Existing Apache installations using mod_php, rather than PHP-FPM
  • PHP installations already on the same major/minor branch as the patched release
  • Apache managed by a Homebrew user service or a supported direct-httpd system LaunchDaemon
  • Systems with compatible development libraries and compiler tools already installed

Apple's bundled Apache, PHP-FPM-only environments, unusual multi-Apache configurations, and Apple Silicon installations are not currently supported for automatic deployment. Rather than attempt to accommodate every conceivable installation, the utility refuses configurations it cannot safely identify. This is a deliberate restriction. There is little benefit in creating an emergency patching tool that introduces entirely new opportunities to destroy a working server.

getting started

The utility requires Python 3.9 or later, the Xcode Command Line Tools, and the libraries necessary to compile PHP. It uses only Python's standard library, although it invokes familiar external tools including curl, make, and otool. The package contains the main Python script, its diagnostic reporting helper, a standalone PHP report receiver, a configuration example, documentation, and an automated test suite.

PUBLIC BETA TESTING — PLEASE READ BEFORE RUNNING THE INSTALLER. php2shell_rescue is experimental software and has not been validated across the range of hardware, macOS versions, dependencies, and Apache configurations that readers may be operating. I am inviting experienced administrators to help test the utility and report both successes and failures, but this should not be mistaken for a production-certified security update.

Preparation can consume significant processing resources; deployment deliberately stops and starts Apache and may interrupt websites and other services depending on it. A failed installation, unsuccessful rollback, or incompatibility with an extension can leave a server unavailable or require manual recovery. Do not use this beta on a server you cannot afford to interrupt. Maintain verified, restorable backups and an independent method of administering the computer before attempting deployment. The utility makes no guarantee of successful installation, recovery, or security, and is offered for evaluation at the tester's own risk. It is published under the MIT License "AS IS", without warranty. Read LICENSE and BETA_NOTICE.md in the archive before running it.

If you choose to participate, the report command lets you review and voluntarily submit a small diagnostic report directly from Terminal, with no website account or browser. It contains predefined operation results, platform and version information, and aggregate error categories; raw compiler logs, configuration files, usernames, hostnames, and network addresses are not uploaded. The receiving web server may nonetheless record your public IP address in its own access logs. Reports are held in private storage, with a 30-day cleanup target, and no individual support or response is guaranteed.

Do not submit private logs or configurations separately without reviewing them. Please inspect the utility's source and reporting documentation before using it. The public beta download and voluntary report intake are available; review the source and reporting terms before participating.

Download php2shell_rescue 0.3.4 (public beta) — MIT-licensed source code, beta notice, documentation and tests.

SHA-256: 1a28c5244255c9d053742832138fe6dce28d525578936043629dfcecddb639d7 — download checksum file (.sha256).

The project is also available on GitHub, where you can review the source code and documentation or submit an issue. The v0.3.4-beta prerelease includes the same downloadable application archive and checksum file.

Before extracting the archive, compare its checksum with the value above, or download both files into the same directory and verify them using macOS Terminal:

shasum -a 256 php2shell-rescue-0.3.4-beta.zip
shasum -a 256 -c php2shell-rescue-0.3.4-beta.zip.sha256

The second command should return php2shell-rescue-0.3.4-beta.zip: OK. If verification fails, do not run the utility. A SHA-256 checksum confirms that the archive matches the published value, but cannot independently authenticate who published it.

After extracting the package, the first operation should be an audit:

python3 php2shell_rescue.py audit

This is a read-only operation. It examines the existing Apache configuration, identifies the PHP module, checks relevant development tools, and assesses whether the configuration is a preliminary candidate, requires manual review, or is unsupported. Even a promising audit cannot establish that compilation or live deployment will succeed. The utility does not attempt to correct anything at this stage, and now invites administrators to submit sanitized diagnostic reports after both successful and unsuccessful audits.

The resulting Terminal output may contain local paths, service details, and other identifying data, so don't publish it without review. The optional report command instead shows an allowlisted JSON summary for inspection before asking permission to submit it.

preparing the replacement php installation

Once the environment has been examined, the next step is to prepare a candidate installation:

python3 php2shell_rescue.py prepare \
	--version 8.5.12 \
	--work "$HOME/php2shell-work-8.5.12"

For installations running PHP 8.2, 8.3, or 8.4, the corresponding patched version can be specified instead. The prepare command downloads the official PHP source archive and verifies its SHA-256 digest against a checksum included in the utility. Only the four explicitly supported security releases are accepted, preventing the script from silently selecting an unexpected PHP version.

Next, the utility examines the existing PHP configuration and attempts to reconstruct the relevant compilation options using php-config. Administrators can also provide a configuration file containing custom configure arguments when their environment requires additional attention. This flexibility is important because the various libraries available on an older Mac may reside in locations that differ considerably from those expected by a modern Homebrew installation.

For example, the following environment variables can influence compilation:

VariablePurpose
CPPFLAGSHeader search paths
LDFLAGSLinker and library paths
LIBSExplicit library dependencies
PKG_CONFIG_PATHPackage configuration lookup
CFLAGSAdditional compiler options

The utility does not rebuild missing dependencies or automatically replace incompatible libraries. Instead, it attempts to use the compatible components already present, leaving unusual configurations for administrator review.

On older hardware, compilation also deserves some restraint. The default configuration uses a single compilation job rather than attempting to occupy every available processor thread. This may take longer, but it reduces the likelihood of exhausting memory or subjecting an aging laptop to unnecessary thermal stress. As someone who has watched this particular MacBook's processor temperatures under heavy workloads, I'm perfectly comfortable sacrificing a little compilation speed in exchange for keeping the computer operational.

When compilation is complete, the new binaries are staged in a private working directory, separate from the installed PHP runtime. The utility verifies that the new command-line executable reports the expected version and records the libraries required by the Apache module. At this point, the running server has not been modified. An unsuccessful compilation cannot directly replace the installed PHP module, and the original Apache configuration remains untouched.

deploying the new php module

The deployment command requires the working directory created during preparation and a PHP-enabled document directory that can be reached through a local HTTP request. For example:

python3 php2shell_rescue.py deploy \
	--work "$HOME/php2shell-work-8.5.12" \
	--probe-dir "/path/to/document-root" \
	--probe-base "http://127.0.0.1:8080/"

The directory and port are examples; administrators must supply values appropriate to their own Apache installation. Virtual hosts may also require the --host-header option to ensure that the test reaches the intended website. The probe URL must map to the specified directory.

Before deployment, the script verifies that Apache is serving the expected PHP branch, that the configuration and binaries have not changed since preparation, and that the replacement module matches the previously recorded checksum. It then preserves the existing Apache configuration and places the replacement PHP module in a new, version-specific location. The original module is retained, making it possible to restore the previous installation if necessary.

The script requires explicit confirmation before proceeding with the service interruption. An important discovery during the original upgrade was that a graceful Apache restart did not successfully activate the replacement PHP module. A clean stop and start resolved the problem, and php2shell_rescue follows that approach.

The utility supports either a Homebrew user service or a compatible system LaunchDaemon. The latter requires administrator privileges for deployment and rollback, but compilation itself should still be performed under a normal user account. For systems managed by a direct-httpd system LaunchDaemon, the service identity is specified during preparation:

python3 php2shell_rescue.py prepare \
	--version 8.5.12 \
	--work "$HOME/php2shell-work-8.5.12" \
	--service launchd-system \
	--launchd-plist /Library/LaunchDaemons/EXAMPLE.apache.plist

On these installations, the deploy and rollback commands must be run with sudo and an absolute working-directory path. Only the selected Apache service is stopped and started; no full-system reboot is required or performed. The LaunchDaemon adapter has not yet been validated on real-world volunteer systems.

verification and rollback

A successful Apache start is not sufficient proof that PHP has been updated. The command-line executable may report one version while Apache continues using another, and the presence of a new module file does not establish that Apache has actually loaded it.

php2shell_rescue therefore creates a temporary PHP test file within the designated document directory and makes an HTTP request through the local Apache server. The test examines the PHP version, confirms the apache2handler interface, and compares the available extensions against those reported before deployment.

It also verifies that session upload progress has been disabled, in response to the additional PHP advisory published October 23 concerning CVE-2026-115560. This protects against the unusual configuration described in that advisory; it is not a substitute for installing the patched PHP release.

If the replacement fails verification, the utility attempts to restore the saved configuration, restart Apache, and confirm that the former PHP installation is once again responding. There are limits to what automated rollback can accomplish. A corrupted filesystem, an unrelated service failure, or damaged configuration files may prevent recovery, and restoring an older PHP version may restore the original vulnerability along with the service. Administrators should therefore maintain independent access and a verified backup.

A manual rollback command is also available:

python3 php2shell_rescue.py rollback \
	--work "$HOME/php2shell-work-8.5.12" \
	--probe-dir "/path/to/document-root" \
	--probe-base "http://127.0.0.1:8080/"

The utility also provides a status command for inspecting the recorded deployment state without making changes:

python3 php2shell_rescue.py status \
	--work "$HOME/php2shell-work-8.5.12"

sending beta reports from terminal

The beta includes a simple reporting command. After running an audit, preparing an upgrade, attempting deployment, or performing a rollback, the utility saves a private, structured diagnostic record. You can review that record and submit it directly from Terminal, without opening a browser or visiting this website:

python3 php2shell_rescue.py report

If the last operation involved a system LaunchDaemon and was run with sudo, the report can instead be retrieved from the working directory used for that operation:

python3 php2shell_rescue.py report \
	--work /ABSOLUTE/PATH/TO/WORK

The reporting tool displays the exact JSON content it intends to transmit. Only after the tester enters SEND will it attempt an HTTPS submission. A successful upload returns a tracking ID, making it possible to identify the report later. No report is transmitted automatically after an error, and declining to participate does not affect installation or recovery.

For privacy, the upload contains a controlled set of diagnostic fields rather than a copy of the installation logs. Error categories such as a missing compiler header or a linker failure are counted, but the potentially sensitive lines containing filesystem paths and other identifying information remain on the tester's computer. This makes the initial reports useful for identifying patterns without requiring volunteers to publish their local server configurations. The server's own HTTP logs may still record the connecting IP address, and the reporting service is subject to storage and submission limits.

The current reporting receiver is a standalone PHP endpoint, independent of the website's article framework and user-management system. Once the endpoint is configured and verified, it can accept reports without introducing a new login, comment form, or upload page. This is an initial reporting arrangement rather than a substitute for a more comprehensive application-support system.

One further limitation deserves mention: php2shell_rescue checks that previously loaded extension names remain available, but it does not test every extension's functionality. Extensions such as Imagick may require rebuilding, and a successful version check is not a substitute for testing actual application behavior.

why not simply use homebrew?

It's worth asking why an independent utility is necessary when Homebrew already performs much of this work, generally with considerably greater sophistication. The answer is not that Homebrew has become incapable of managing PHP. Rather, its supported operating-system and processor combinations no longer necessarily include the equipment that many of us continue to use.

As of September 2026, Homebrew classified Intel Macs running macOS 11 through 26 as Tier 3 systems, with limited support and diminishing availability of precompiled packages. The project also announced plans to discontinue Intel support in or after September 2027.

This presents an awkward situation for administrators maintaining older Macs. An application may compile and run perfectly well, yet its package-management dependencies may no longer build successfully. Attempting to upgrade a single application can initiate a chain of dependency updates, any one of which may introduce incompatibilities with the operating system.

During the original PHP upgrade, we encountered precisely this problem. Instead of rebuilding the entire dependency environment, we were able to compile PHP 8.5.12 against compatible libraries already installed on the machine. php2shell_rescue formalizes that approach, deliberately limiting the number of components that must change. It doesn't replace Homebrew, and it certainly doesn't offer the extensive package management, compatibility testing, and ongoing maintenance that Homebrew provides. What it does offer is a narrower means of replacing a vulnerable PHP runtime when the conventional package-management route has become impractical. For an emergency security update, that may be all an administrator needs.

a rather unexpected use for artificial intelligence

There's one aspect of this story I find particularly entertaining. The PHP2Shell vulnerabilities were discovered through research involving several organizations, including Calif, Wiz Research, and OpenAI. Artificial intelligence played a meaningful role in the security investigations, helping researchers analyze complicated memory-management failures and establish their exploitability.

When I realized that my own server was affected, I turned to ChatGPT for assistance in getting PHP updated. What followed was a fairly extensive series of experiments involving compiler errors, dependency compatibility, Apache modules, extension loading, and the eventual successful installation of PHP 8.5.12.

Having used AI to help solve the original installation problems, it seemed reasonable to push the idea further. If we could diagnose and resolve these failures interactively, why not consolidate the process into a utility that could benefit others facing similar problems? That became the motivation for php2shell_rescue.

Of course, there's an important difference between code that looks plausible and code that can be trusted to replace a critical server component. The utility's automated tests have been successful, but independent testing on real systems remains essential. The project is now open to volunteer beta testing so that we can learn how reliably it handles different Intel Macs, Apache service arrangements, and PHP configurations. In the meantime, the source is available for inspection, and the utility's documentation describes its supported environments and limitations. Administrators should review the code and deployment procedure before attempting to use it on an important server.

AI has proved remarkably useful in accelerating this project, but I have no intention of treating a chatbot's confidence as an acceptable substitute for a working test.

another lease on life

My original goal was comparatively modest: update PHP on an old MacBook Pro without breaking the server I've spent years maintaining. That objective was achieved manually, and it demonstrated that the hardware remained perfectly capable of running the patched software. php2shell_rescue is an attempt to make the same solution more accessible to other administrators who find themselves in similar circumstances.

I don't imagine that every computer deserves to be maintained indefinitely. Hardware eventually fails, software requirements change, and there are legitimate circumstances in which replacing an aging system is the most sensible decision. Nor should anyone confuse maintaining a current PHP installation with maintaining a fully supported and secure operating system.

But there is something particularly unsatisfying about discarding a functioning computer because the tools responsible for maintaining its software have decided that it no longer belongs. Many of us keep older machines running because they continue to be useful, because we enjoy understanding how they work, or simply because we see no good reason to throw away something that still does its job. These are perfectly reasonable motivations, even if they occasionally result in spending an entire afternoon resolving a dependency problem that a newer machine might never encounter.

The MacBook Pro that inspired this project is still running, and I intend to keep it that way for as long as maintaining it remains practical. I wasn't about to let two PHP vulnerabilities put an end to that effort. And if artificial intelligence can help identify the problems, perhaps it can also help a few perfectly serviceable old computers survive the solutions.

Sources

PHP Development Team: Critical RCE advisory (October 21, 2026)

PHP Development Team: Session upload progress advisory (October 23, 2026)

Amazon Web Services: PHP2Shell exploitation prior to disclosure

Homebrew: Support Tiers

Wiz Research: PHP2Shell security research

php2shell_rescue attempts to provide an emergency patching solution for Apache/mod_php servers running on older Intel-based Macs, compiling patched PHP around outdated Homebrew dependencies. If you're struggling to patch PHP2Shell on such a system, consider testing php2shell_rescue and sharing your results to help improve the utility for others.