Skip to content

Conversation

Copy link

Copilot AI commented Nov 7, 2025

Description

wp core install and related commands fail silently with exit code 255 when WordPress files can't be loaded (missing PHP extensions, corrupted installation, permission issues). Debug output stops at "Begin WordPress load" with no actionable error.

Changes

Added centralized error handling for require_once ABSPATH . 'wp-admin/includes/upgrade.php':

  • Created require_upgrade_file() helper method with:

    • File existence validation
    • Readability checks
    • Shutdown handler to catch fatal errors during file loading
    • Completion flag to prevent shutdown handler from triggering on unrelated errors after successful require
    • Enhanced error type detection (E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_COMPILE_WARNING, E_USER_ERROR)
    • Context-specific error messages (installation, multisite, update, db upgrade)
  • Applied to 4 methods: do_install(), multisite_convert_(), update(), update_db()

Error message improvements

Before: Silent exit with code 255

After:

Error: WordPress installation is incomplete. The file '/path/wp-admin/includes/upgrade.php' is missing.

Or for runtime errors:

Error: Failed to load WordPress files for WordPress installation. This often indicates a missing PHP extension or a corrupted WordPress installation.

Error: Call to undefined function mysqli_connect() in /path/wp-includes/wp-db.php on line 123

Please check that all required PHP extensions are installed and that your WordPress installation is complete.

Checklist

Original prompt

This section details on the original issue you should resolve

<issue_title>core install fails silently (error code 255)</issue_title>
<issue_description>## Bug Report

Describe the current, buggy behavior

wp core install fails silently; echo $? shows error code 255

Describe how other contributors can replicate this bug

Here are the commands I'm running after installing wp-cli:

wp core download
wp config create --dbhost=127.0.0.1 --dbname=$WORDPRESS_DB_NAME --dbuser=$WORDPRESS_DB_USER --dbpass=$WORDPRESS_DB_PASSWORD
wp core install --url=localhost --title=test --admin_user=test --admin_password=test --admin_email=test@example.com

Describe what you would expect as the correct outcome

install succeeds or at least provides more debug info about why it fails

Let us know what environment you are running this on

CircleCI using their PHP and MySQL docker images

Here is the output from running core install again on the CircleCI box directly (via ssh) with all --skip options and --debug added. I tried specifying a path for download, config, and install, but it still fails at the same spot. I can see that the wp-config.php file exists at that path and it looks correct.

Debug (bootstrap): argv: /usr/local/bin/wp core install --url=localhost --title=test --admin_user=test --admin_password=test --admin_email=test@example.com --path=wordpress --debug --skip-themes --skip-plugins --allow-root --skip-email --skip-packages (0.079s)
Debug (bootstrap): ABSPATH defined: /home/circleci/project/wordpress/ (0.079s)
Debug (bootstrap): Set URL: localhost (0.079s)
Debug (bootstrap): Begin WordPress load (0.08s)
Debug (bootstrap): wp-config.php path: /home/circleci/project/wordpress/wp-config.php (0.08s)
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@schlessera</author><body>
I assume in the reporter's case, the issue is something similar to an extension missing. I agree that WP-CLI should do a better job here of letting the user know what is happening. Silently failing is never a good option.</body></comment_new>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 7, 2025 22:17
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix silent failure of wp core install with error code 255 Fix silent failure in core install when loading WordPress files fails Nov 7, 2025
Copilot AI requested a review from swissspidy November 7, 2025 22:27
Copilot finished work on behalf of swissspidy November 7, 2025 22:27
@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

❌ Patch coverage is 34.28571% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Core_Command.php 34.28% 23 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy requested a review from Copilot November 8, 2025 09:42

This comment was marked as resolved.

swissspidy and others added 2 commits November 8, 2025 11:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot finished work on behalf of swissspidy November 8, 2025 10:18
Copilot finished work on behalf of swissspidy November 8, 2025 10:21
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI requested a review from swissspidy November 8, 2025 10:31
Copilot finished work on behalf of swissspidy November 8, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core install fails silently (error code 255)

2 participants