简体   繁体   中英

Mycrpt error using composer with PHP 5.6

I have installed ondrej/php 5.6 7.0 7.1 and 7.2 packages.

PHP 5.6 is installed with all extensions enabled, included 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.

I need to setup a PHP 5.6 using composer install .

But I get mcrypt extension error:

$ 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

I have tried also:

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

and

$ alias composer="/usr/bin/php5.6 /usr/local/bin/composer"
$ composer install

But always with same error.

Any idea about to force composer to use PHP 5.6?

Thanks!

The problem is not about composer, is about php artisan clear-compiled and php artisan optimize configured in post-install-cmd composer.json event.

This commands are executed with native php-cli version.

Solution: https://stackoverflow.com/a/34693504/49114

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM