Francis_0224 2024-10-10 14:33 采纳率: 0%
浏览 13

Rocky Linux 9.4 php + composer 提示 段错误 (核心已转储),应该如何解决?

我们生产环境使用的php语言做的开发,框架是 lumen 5 ,服务器使用的是CentOS 7 + php 7.2.22,近期公司有要求更换服务器提供商,加上 centos 停止维护,所以就把服务器的系统换成了 rocky linux 9.4.
虚拟机中测试安装环境,因 rocky linux 9.4系统自带的openssl是3.x的版本,php 7.2无法支持高版本的openssl,所以通过源码包的方式安装了一个 openssl 1.0.1,然后编译安装php 7.2的时候,启用openssl时将目录指向了重新安装的 openssl 1.0.1的目录。
openssl 1.0.1 和 php 7.2 均安装成功后,通过源码包给 php 安装 mongodb 扩展,安装过程没有什么问题,但是将 php.ini 中添加了 extension=mongodb 之后,执行 php -m 命令时,提示 段错误 (核心已转储) 错误。
先将 mongodb 扩展去掉继续向下走,通过 git 将代码 clone 到系统中,执行composer,完整的命令为 php -d memory_limit=-1 /usr/local/composer/composer install --no-interaction --no-plugins --ignore-platform-reqs ,依然是提示 段错误 (核心已转储) 这个错误。详细的错误如下(错误提示在最后一行):

[root@localhost code]# php -d memory_limit=-1 /usr/local/composer/composer install --no-interaction --no-plugins --ignore-platform-reqs 
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Package operations: 171 installs, 0 updates, 0 removals
  - Downloading kylekatarnls/update-helper (1.2.1)
  - Downloading ocramius/package-versions (1.4.2)
  - Downloading aliyuncs/oss-sdk-php (v2.3.1)
  - Downloading symfony/translation-contracts (v1.1.9)
  - Downloading symfony/polyfill-mbstring (v1.17.1)
  - Downloading symfony/translation (v4.3.11)
  - Downloading nesbot/carbon (1.39.1)
  - Downloading psr/simple-cache (1.0.1)
  - Downloading psr/container (1.0.0)
  - Downloading illuminate/contracts (v5.5.44)
  - Downloading doctrine/inflector (1.4.3)
  - Downloading illuminate/support (v5.5.44)
  - Downloading symfony/finder (v3.4.42)
  - Downloading illuminate/filesystem (v5.5.44)
  - Downloading chumper/zipper (v1.0.3)
  - Downloading league/fractal (0.17.0)
  - Downloading symfony/routing (v3.4.42)
  - Downloading symfony/polyfill-util (v1.17.1)
  - Downloading symfony/polyfill-php56 (v1.17.1)
  - Downloading symfony/polyfill-ctype (v1.17.1)
  - Downloading paragonie/random_compat (v9.99.99)
  - Downloading symfony/polyfill-php70 (v1.17.1)
  - Downloading symfony/http-foundation (v3.4.42)
  - Downloading symfony/event-dispatcher-contracts (v1.1.9)
  - Downloading symfony/event-dispatcher (v4.4.10)
  - Downloading psr/log (1.1.3)
  - Downloading symfony/debug (v3.4.42)
  - Downloading symfony/http-kernel (v3.4.42)
  - Downloading illuminate/session (v5.5.44)
  - Downloading illuminate/pipeline (v5.5.44)
  - Downloading illuminate/http (v5.5.44)
  - Downloading illuminate/container (v5.5.44)
  - Downloading illuminate/routing (v5.5.44)
  - Downloading webmozart/assert (1.9.0)
  - Downloading phpdocumentor/reflection-common (2.2.0)
  - Downloading phpdocumentor/type-resolver (1.3.0)
  - Downloading phpdocumentor/reflection-docblock (4.3.4)
  - Downloading doctrine/lexer (1.2.1)
  - Downloading doctrine/annotations (1.10.3)
  - Downloading dingo/blueprint (v0.3.1)
  - Downloading dingo/api (v2.4.7)
  - Downloading symfony/console (v3.4.42)
  - Downloading doctrine/instantiator (1.3.1)
  - Downloading doctrine/event-manager (1.1.0)
  - Downloading doctrine/cache (1.10.2)
  - Downloading doctrine/dbal (2.10.2)
  - Downloading doctrine/reflection (1.2.1)
  - Downloading doctrine/collections (1.6.6)
  - Downloading doctrine/persistence (1.2.0)
  - Downloading doctrine/common (2.12.0)
  - Downloading doctrine/orm (v2.6.6)
  - Downloading facile-it/doctrine-mysql-come-back (v1.8)
  - Downloading firebase/php-jwt (v5.2.0)
  - Downloading fzaninotto/faker (v1.9.1)
  - Downloading behat/transliterator (v1.3.0)
  - Downloading gedmo/doctrine-extensions (v2.4.41)
  - Downloading psr/http-message (1.0.1)
  - Downloading php-http/message-factory (v1.0.2)
  - Downloading clue/stream-filter (v1.4.1)
  - Downloading php-http/message (1.8.0)
  - Downloading php-http/promise (1.1.0)
  - Downloading php-http/httplug (v1.1.0)
  - Downloading symfony/polyfill-php72 (v1.17.0)
  - Downloading symfony/polyfill-intl-idn (v1.17.1)
  - Downloading ralouphie/getallheaders (3.0.3)
  - Downloading guzzlehttp/psr7 (1.6.1)
  - Downloading guzzlehttp/promises (v1.3.1)
  - Downloading guzzlehttp/guzzle (6.5.5)
  - Downloading php-http/guzzle6-adapter (v1.1.1)
  - Downloading php-http/discovery (1.9.0)
  - Downloading symfony/polyfill-php80 (v1.17.1)
  - Downloading symfony/deprecation-contracts (v2.1.3)
  - Downloading symfony/options-resolver (v5.1.2)
  - Downloading php-http/client-common (1.10.0)
  - Downloading myclabs/php-enum (1.7.6)
  - Downloading graphaware/neo4j-common (3.5.0)
  - Downloading graphaware/neo4j-bolt (1.11.0)
  - Downloading graphaware/neo4j-php-client (4.8.5)
  - Downloading gregwar/captcha (v1.1.8)
  - Downloading hashids/hashids (3.0.0)
  - Downloading league/flysystem (1.0.69)
  - Downloading iidestiny/flysystem-oss (1.4.0)
  - Downloading iidestiny/laravel-filesystem-oss (1.3.0)
  - Downloading symfony/process (v3.4.42)
  - Downloading illuminate/database (v5.5.44)
  - Downloading illuminate/console (v5.5.44)
  - Downloading illuminate/queue (v5.5.44)
  - Downloading illuminate/bus (v5.5.44)
  - Downloading illuminate/broadcasting (v5.5.44)
  - Downloading illuminate/encryption (v5.5.44)
  - Downloading illuminate/hashing (v5.5.44)
  - Downloading illuminate/pagination (v5.5.44)
  - Downloading predis/predis (v1.1.1)
  - Downloading illuminate/redis (v5.5.44)
  - Downloading illuminate/translation (v5.5.44)
  - Downloading illuminate/validation (v5.5.44)
  - Downloading illuminate/events (v5.5.44)
  - Downloading illuminate/view (v5.5.44)
  - Downloading symfony/serializer (v4.4.10)
  - Downloading illuminate/auth (v5.5.44)
  - Downloading laravel-doctrine/orm (1.4.18)
  - Downloading illuminate/config (v5.5.44)
  - Downloading laravel-doctrine/extensions (1.0.14)
  - Downloading zendframework/zend-eventmanager (3.2.1)
  - Downloading zendframework/zend-code (3.4.1)
  - Downloading ocramius/proxy-manager (2.2.3)
  - Downloading doctrine/migrations (v1.8.1)
  - Downloading laravel-doctrine/migrations (1.2.0)
  - Downloading symfony/css-selector (v5.1.2)
  - Downloading tijsverkoyen/css-to-inline-styles (2.2.2)
  - Downloading phpoffice/phpexcel (1.8.2)
  - Downloading nikic/php-parser (v4.6.0)
  - Downloading jeremeamia/superclosure (2.4.0)
  - Downloading illuminate/cache (v5.5.44)
  - Downloading maatwebsite/excel (2.1.30)
  - Downloading maxbrokman/safe-queue (v0.3.0)
  - Downloading milon/barcode (5.3.6)
  - Downloading hamcrest/hamcrest-php (v1.2.2)
  - Downloading mockery/mockery (0.9.11)
  - Downloading mtdowling/cron-expression (v1.2.1)
  - Downloading nikic/fast-route (v1.3.0)
  - Syncing shopex/teegon (v2.0.7) into cache
  - Downloading monolog/monolog (1.25.4)
  - Downloading laravel/lumen-framework (v5.5.2)
  - Downloading onex/espier-rpccall (dev-master 19060cd)
  - Downloading zircote/swagger-php (2.0.16)
  - Downloading onex/espier-swagger (0.2)
  - Downloading onex/espier-swoole (1.1.3)
  - Downloading symfony/psr-http-message-bridge (v1.2.0)
  - Downloading pimple/pimple (v3.3.0)
  - Downloading overtrue/socialite (1.3.0)
  - Downloading onex/wechat (3.3.25)
  - Downloading qiniu/php-sdk (v7.2.10)
  - Downloading overtrue/flysystem-qiniu (1.0.5)
  - Downloading overtrue/laravel-filesystem-qiniu (1.0.2)
  - Downloading phpunit/php-token-stream (2.0.2)
  - Downloading symfony/yaml (v4.4.10)
  - Downloading sebastian/version (2.0.1)
  - Downloading sebastian/resource-operations (1.0.0)
  - Downloading sebastian/recursion-context (2.0.0)
  - Downloading sebastian/object-enumerator (2.0.1)
  - Downloading sebastian/global-state (1.1.1)
  - Downloading sebastian/exporter (2.0.0)
  - Downloading sebastian/environment (2.0.0)
  - Downloading sebastian/diff (1.4.3)
  - Downloading sebastian/comparator (1.2.4)
  - Downloading phpunit/php-text-template (1.2.1)
  - Downloading phpunit/phpunit-mock-objects (3.4.4)
  - Downloading phpunit/php-timer (1.0.9)
  - Downloading phpunit/php-file-iterator (1.4.5)
  - Downloading sebastian/code-unit-reverse-lookup (1.0.1)
  - Downloading phpunit/php-code-coverage (4.0.8)
  - Downloading phpspec/prophecy (v1.10.3)
  - Downloading myclabs/deep-copy (1.10.1)
  - Downloading phpunit/phpunit (5.7.27)
  - Downloading sentry/sentry (1.11.0)
  - Downloading sentry/sentry-laravel (0.10.1)
  - Downloading shopex/prism (v1.4.7)
  - Downloading symfony/inflector (v4.4.10)
  - Downloading symfony/property-access (v3.4.42)
  - Downloading symfony/var-dumper (v3.4.42)
  - Downloading textalk/websocket (1.3.1)
  - Downloading namshi/jose (7.2.3)
  - Downloading lcobucci/jwt (3.3.2)
  - Downloading tymon/jwt-auth (1.0.0)
  - Downloading php-amqplib/php-amqplib (v2.6.3)
  - Downloading vladimir-yuldashev/laravel-queue-rabbitmq (5.5)
  - Downloading vlucas/phpdotenv (v2.6.5)
  - Downloading yansongda/supports (v1.9.0)
  - Downloading yansongda/pay (v2.7.8)
  - Downloading yly-openapi/yly-openapi-sdk (1.0.1)
   0/170 [>---------------------------]   0%段错误 (核心已转储)

网上查过资料,知道基本的原因,也尝试使用网上提供的 ulimit -c 102400 方案来解决,依然无效。
请问各位,这种错误如何调试如何解决?

  • 写回答

1条回答 默认 最新

  • 檀越@新空间 2024-10-10 14:35
    关注

    下午好🌅🌅🌅
    本答案参考ChatGPT-3.5

    以下是一些可能的解决方案:

    1. 检查和替换openssl错误
    ```
    sudo apt-get update
    sudo apt-get install php7.2-openssl
    ```
    
    1. 删除mongodb扩展
    ```
    sudo rm -rf /usr/local/composer/composer.lock
    sudo rm -rf /usr/local/composer/composer.lock/{require-dev}
    ```
    
    1. 更新composer.json
    ```
    sudo composer update --no-interaction --no-plugins --ignore-platform-reqs
    ```
    
    1. 使用新的openssl库版本
    ```
    sudo apt-get install php7.2-openssl=1.1.1
    ```
    
    1. 添加extension=mongodb
    ```
    sudo echo "extension=mongodb" >> /etc/php/conf.d/mongodb.ini
    ```
    
    1. 验证扩展是否被正确安装
    ```
    phpinfo();
    ```
    

    如果以上方法都无法解决问题,那么你可能需要寻求专业的技术支持或者考虑更换服务器环境。

    评论

报告相同问题?

问题事件

  • 创建了问题 10月10日