在PHP5.6中使用composer时出现Mycrpt错误

在PHP5.6中使用composer时出现Mycrpt错误,php,composer-php,mcrypt,Php,Composer Php,Mcrypt,我已经安装了ondrej/PHP5.677.071和7.2软件包 PHP5.6安装时启用了所有扩展,包括mcrypt $ alias php="/usr/bin/php5.6" $ php -v PHP 5.6.36-1+ubuntu16.04.1+deb.sury.org+1 (cli) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

我已经安装了ondrej/PHP5.677.071和7.2软件包

PHP5.6安装时启用了所有扩展,包括
mcrypt

$ alias php="/usr/bin/php5.6"

$ php -v

PHP 5.6.36-1+ubuntu16.04.1+deb.sury.org+1 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

$ php -i | grep mcrypt

/etc/php/5.6/cli/conf.d/20-mcrypt.ini,
Registered Stream Filters => zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

$ composer show -i

You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.

aws/aws-sdk-php                   2.8.31             AWS SDK for PHP - Use Amazon Web Services in your PHP project
barryvdh/laravel-debugbar         v1.8.9             PHP Debugbar integration for Laravel
baum/baum                         1.0.15             Baum is an implementation of the Nested Set pattern for Eloquent models.
brouwers/shortcodes               1.0.2              Wordpress like shortcodes for Laravel 4.2
cartalyst/sentry                  v2.1.7             PHP 5.3+ Fully-featured Authentication & Authorization System
classpreloader/classpreloader     1.0.2              Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case
d11wtq/boris                      v1.0.10            A tiny, but robust REPL (Read-Evaluate-Print-Loop) for PHP.
damianromanowski/simplecdn        dev-master 47611af Laravel 4 simple content delivery network URL rewriter
estina/smartfocus                 1.3.0              SmartFocus API
filp/whoops                       1.1.10             php error handling for cool kids
guzzle/guzzle                     v3.9.3             PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle
guzzlehttp/guzzle                 6.3.3              Guzzle is a PHP HTTP client library
guzzlehttp/promises               v1.3.1             Guzzle promises library
guzzlehttp/psr7                   1.4.2              PSR-7 message implementation that also provides common utility methods
imagecow/imagecow                 v1.5.1             PHP library to manipulate and generate responsive images
ircmaxell/password-compat         v1.0.4             A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash
jeremeamia/SuperClosure           1.0.2              Doing interesting things with closures like serialization.
kevbaldwyn/image                  dev-master 0cb45d5 A Laravel 4 package to aid generating automatically resized images on the fly and generating responsive images.
laravel/framework                 v4.2.22            The Laravel Framework.
maatwebsite/excel                 1.3.10             An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel
mailin-api/mailin-api-php         dev-master b437808 Official SendinBlue provided API V2 wrapper
mandrill/mandrill                 1.0.55             API client library for the Mandrill email as a service platform
maximebf/debugbar                 v1.10.5            Debug bar in the browser for php application
monolog/monolog                   1.23.0             Sends your logs to files, sockets, inboxes, databases and various web services
nesbot/carbon                     1.32.0             A simple API extension for DateTime.
nikic/php-parser                  v0.9.5             A PHP parser written in PHP
paragonie/random_compat           v1.4.3             PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
patchwork/utf8                    v1.3.1             Portable and performant UTF-8, Unicode and Grapheme Clusters for PHP
phpoffice/phpexcel                1.8.1              PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
phpseclib/phpseclib               0.3.10             PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
predis/predis                     v0.8.7             Flexible and feature-complete PHP client library for Redis
psr/http-message                  1.0.1              Common interface for HTTP messages
psr/log                           1.0.2              Common interface for logging libraries
roumen/feed                       v2.8.8             A simple feed generator for Laravel.
stack/builder                     v1.0.5             Builder for stack middlewares based on HttpKernelInterface.
swiftmailer/swiftmailer           v5.4.9             Swiftmailer, free feature-rich PHP mailer
symfony/browser-kit               v2.7.48            Symfony BrowserKit Component
symfony/console                   v2.7.48            Symfony Console Component
symfony/css-selector              v2.7.48            Symfony CssSelector Component
symfony/debug                     v2.7.48            Symfony Debug Component
symfony/dom-crawler               v2.7.48            Symfony DomCrawler Component
symfony/event-dispatcher          v2.8.42            Symfony EventDispatcher Component
symfony/filesystem                v2.8.42            Symfony Filesystem Component
symfony/finder                    v2.7.48            Symfony Finder Component
symfony/http-foundation           v2.7.48            Symfony HttpFoundation Component
symfony/http-kernel               v2.7.48            Symfony HttpKernel Component
symfony/polyfill-ctype            v1.8.0             Symfony polyfill for ctype functions
symfony/polyfill-mbstring         v1.8.0             Symfony polyfill for the Mbstring extension
symfony/process                   v2.7.48            Symfony Process Component
symfony/routing                   v2.7.48            Symfony Routing Component
symfony/security-core             v2.7.48            Symfony Security Component - Core Library
symfony/translation               v2.7.48            Symfony Translation Component
symfony/var-dumper                v2.8.42            Symfony mechanism for exploring and dumping PHP variables
tijsverkoyen/css-to-inline-styles 1.5.5              CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles.
我需要使用
composer安装
设置PHP5.6

但我得到了mcrypt扩展错误:

$ composer install

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
Mcrypt PHP extension required.
Script php artisan clear-compiled handling the post-install-cmd event returned with error code 1
我也尝试过:

$ /usr/bin/php5.6 /usr/local/bin/composer install

但总是有同样的错误

有没有想过要强制composer使用PHP5.6


谢谢

问题不在于composer,而在于
php artisan clear compiled
php artisan optimize
post install cmd
composer.json事件中配置

此命令使用本机php cli版本执行


解决方案:

您需要在compose package.json中检查是否需要任何特定版本的mcrypt。我已经安装了最新的mcrypt版本。无效版本上的错误与未安装扩展不同(因为当前错误:“Mcrypt PHP extension required”)。在输出
没有安装或更新的内容之后,您是否可以检查“composer show-i”的输出是什么,并使用
composer show-i
更新问题详细信息,该错误是在composer.json的scripts部分中执行的其中一项操作导致的。您可以发布composer.json的这部分内容吗?可能有一个命令
php artisan clear compiled
会抛出错误
$ alias composer="/usr/bin/php5.6 /usr/local/bin/composer"
$ composer install