Automattic / Automattic/studio

Failed to start WordPress server: PHP command failed (code: 1) on every site creation attempt (Windows 11)

Open
#4,749 0 comments 0 reactions 0 assignees View on GitHub
[Status] Auto-allocated Bug YOLO
Dominant language
TypeScript
Stars
517
Forks
95
Avg merge
1d 22h
Merged PRs (30d)
162

Description

### Quick summary

Every attempt to create a new WordPress site fails with "PHP command failed (code: 1)". The bundled php.exe runs fine when invoked directly from a terminal (including php.exe -S to start a local server), but fails every time when spawned by Studio.

### Steps to reproduce

1. Start the Studio app.
2. Click on 'Add site'.
3. Fill in any site name and click 'Create site'.
4. The error appears immediately: "Failed to start WordPress server: PHP command failed (code: 1)".

This happens with every project path tested (including a fully ASCII path like C:\Studio\Test), with a fresh reinstall, and after rebooting.

### What you expected to happen

The new WordPress site should be created and start successfully.

### What actually happened

Site creation fails every time with: Error invoking remote method 'createSite': CliCommandError: [Last error message] Failed to start WordPress server: PHP command failed (code: 1) [Base message] Failed to create site [Exit code] 1

### App or CLI?

Studio App

### Version

1.20.0

### Impact

One

### Available workarounds?

No and the app is unusable

### Platform

Windows

### Architecture

x64 (Intel, AMD)

### Logs or notes

Environment: Windows 11 Business (build 10.0.26200.9106), corporate-managed laptop. Windows username contains an accented/non-ASCII character.

Things already ruled out:
- Non-ASCII username in path: tested both C:\Users\\Studio\... and fully ASCII C:\Studio\Test — same error both times.
- TEMP/TMP redirected to C:\Temp (ASCII), rebooted — no change.
- 8dot3name confirmed ENABLED via fsutil.
- Windows Defender exclusions added for C:\Studio and %LOCALAPPDATA%\studio_app — no change. Protection History/Quarantine shows nothing related.
- AppLocker is active (corporate policy) but no blocking events (8004) around failure times, only routine policy events.
- PHP binary itself (...\studio_app\app-1.20.0\resources\php-bin\8.4.24-studio-2\php.exe) works perfectly standalone:
- php.exe --version → PHP 8.4.24 (cli), no errors
- php.exe -m → normal module list
- php.exe -S 127.0.0.1:8881 → starts and listens successfully
- Killed all Studio processes + rebooted before retries — same result.
- Full uninstall + deleted %LOCALAPPDATA%\studio_app and %APPDATA%\Studio + reinstall — same error persists.

Also noticed: on several launches, before any site-creation attempt, the log shows a recurring Squirrel updater failure ("Couldn't acquire lock, is another instance running"), even after a clean reinstall. Not sure if related.

Repeating log excerpt on every attempt:
[info][main] Checking PHP 8.4 binary…
[info][main] Starting WordPress server…
[erro][main] Error occurred in handler for 'createSite': CliCommandError: [Last error message] Failed to start WordPress server: PHP command failed (code: 1) [Base message] Failed to create site [Exit code] 1

The info-level logging doesn't capture the actual PHP stderr/stdout, so I can't see the underlying error. Is there a way to get more verbose/debug output from Studio showing the exact command line and stderr used to spawn the WordPress server?

Contributor guide

Open the contributing guide

Research direction

Start at the Studio app's createSite handler and the WordPress server startup path, using the repeated “Checking PHP” and “Starting WordPress server” log entries as entry points. Reproduce on Windows 11 with the bundled php.exe, capture the exact command and PHP stdout/stderr, and make site creation succeed while preserving useful failure diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, php, typescript
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.