You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Lumen项目创建依赖安装失败求助:缺失PHP ext-dom扩展

解决Lumen项目依赖安装失败(缺失ext-dom扩展)的方案

Hey there, fellow Lumen newbie! I’ve been in your shoes before—missing PHP extensions can throw a real wrench in getting a new project set up. Let’s fix this ext-dom issue step by step.

The ext-dom extension is a core PHP component required by several testing and dependency packages (like the ones you mentioned: phar-io/manifest, phpunit/php-code-coverage). Since you’ve confirmed your PHP version is correct, we just need to install and enable this extension for your system:

针对 Debian/Ubuntu 系统

Open your terminal and run this command (replace phpX.X with your actual PHP version, e.g., php8.2):

sudo apt-get install phpX.X-dom

After installation, restart your web server (if using one) and navigate to your blog folder to run composer install manually to finish dependency setup.

针对 CentOS/RHEL 系统

Use yum to install the extension (replace phpX.X with your PHP version):

sudo yum install phpX.X-xml

Note: On CentOS/RHEL, the dom extension is included in the php-xml package. Restart your server afterward and re-run the dependency install command.

针对 Windows 系统

  1. Open your PHP installation folder (typically C:\phpX.X)
  2. Locate the php.ini file and open it in a text editor
  3. Find the line ;extension=dom and remove the leading semicolon to uncomment it
  4. Save the file and restart your web server (or CLI if running commands directly)
  5. Navigate to your blog folder in PowerShell/Command Prompt and run composer install

针对 macOS 系统

If you installed PHP via Homebrew, run this command (match your PHP version):

brew install phpX.X-dom

If the dom extension is part of Homebrew’s core PHP package, just ensure it’s enabled in your php.ini file. Restart your terminal afterward and run composer install in your project folder.

验证扩展是否安装成功

To confirm ext-dom is enabled, run this command in your terminal:

php -m | grep dom

You should see dom listed in the output if it’s correctly installed and enabled.

Once the extension is set up, head back to your blog directory and run composer install manually—this will pull in all required packages without the earlier errors.


内容的提问来源于stack exchange,提问作者Flame of udun

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:18:37