aaPanel / aaPanel/aaPanel

[Bug] PHP 8.5 has mbstring compiled in, but mbstring.sh appends mbstring.so and causes "Module already loaded"

Open Beginner friendly
#287 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.1k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Environment:

  • Ubuntu 26.04 LTS x86_64
  • PHP 8.5.8 installed by aaPanel
  • Script: /www/server/panel/install/mbstring.sh

Problem:
aaPanel builds PHP 8.5 with --enable-mbstring, so mbstring is already
available even when PHP is started with -n.

Reproduction:

/www/server/php/85/bin/php -n -r
'echo extension_loaded("mbstring") ? "loaded\n" : "missing\n";'

Output:
loaded

After installing mbstring from aaPanel, mbstring.sh appends:

extension = /www/server/php/85/lib/php/extensions/no-debug-non-zts-20250925/mbstring.so

to both php.ini and php-cli.ini.

Every PHP invocation then prints:

PHP Warning: Module "mbstring" is already loaded in Unknown on line 0

Root cause:
Install_mbstring() only treats mbstring as installed when both a
/mbstring.so configuration line and php -m output exist. It does not
detect a statically compiled mbstring module.

Suggested fix:
Before building or appending mbstring.so, test the no-configuration PHP
binary:

/www/server/php/$version/bin/php -n -r
'exit(extension_loaded("mbstring") ? 0 : 1);'

If it returns 0, report mbstring as built in and do not append the
dynamic extension line.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with /www/server/panel/install/mbstring.sh and inspect Install_mbstring(). Run the provided php -n extension_loaded check alongside the existing installation checks. Done means built-in mbstring is recognized without appending mbstring.so to php.ini or php-cli.ini, and PHP invocations no longer warn.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, php
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.