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

无法安装PHP的intl扩展:编译提示php_smart_str.h文件缺失求助

Fixing the 'php_smart_str.h' Not Found Error When Installing PHP intl Extension via PECL

Hey there, I’ve run into this exact error before—let’s walk through how to fix it step by step. The missing php_smart_str.h file is part of PHP’s standard extension development headers, so the issue usually boils down to missing dependencies or incorrect path configuration.

Step 1: Install Required System Dependencies

First, make sure you have the necessary development packages installed, both for PHP itself and the ICU library (which the intl extension relies on):

For Debian/Ubuntu-based systems:

sudo apt update
sudo apt install php-dev libicu-dev

Note: If you’re using a specific PHP version (like 8.1), use php8.1-dev instead of php-dev.

For RHEL/CentOS/Rocky Linux systems:

sudo dnf install php-devel libicu-devel

For older RHEL/CentOS versions, replace dnf with yum.

Step 2: Reinstall the intl Extension

Once the dependencies are in place, try running the PECL install command again:

sudo pecl install intl

Step 3: If the Error Persists—Manually Specify PHP Paths

If you still see the missing header error, it might be because PECL can’t locate your PHP development files. Let’s fix that:

  1. First, find where php_smart_str.h is located on your system:
find /usr -name php_smart_str.h

You’ll get a path like /usr/include/php/ext/standard/php_smart_str.h.

  1. Use that path to specify the include directory when installing:
sudo pecl install --with-include-dir=/usr/include/php/ext/standard/ intl

Alternatively, you can point PECL to your system’s php-config binary (which holds all the correct path info):

sudo pecl install intl --with-php-config=$(which php-config)

Step 4: Verify the Installation

After a successful install, don’t forget to enable the extension in your PHP config. Add this line to your php.ini file (or a dedicated conf file in /etc/php/[version]/mods-available/):

extension=intl.so

Then restart your web server or PHP-FPM to apply the changes.

内容的提问来源于stack exchange,提问作者Sory

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 09:29:12