使用GitlabCI部署Laravel在mcrypt扩展上失败

时间:2017-12-05 10:02:13

标签: php laravel docker laravel-4 mcrypt

我想用GitLabCI和docker部署我的Laravel项目。我有一个yaml文件,其中包含以下before_script

docker-php-ext-install mbstring mcrypt pdo_mysql curl json intl gd xml zip bz2 opcache

它的回归:

error: /usr/src/php/ext/mcrypt does not exist

usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop

if custom ./configure arguments are necessary, see docker-php-ext-configure

Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip

Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
ERROR: Job failed: exit code 1

我尝试在these个答案之后使用apt-get install手动安装mcrypt,但没有任何方法可以帮助我。 Cheked this论坛帖子,但没有提到这个错误。

gitlab-ci.yaml文件:

before_script:
  # Update packages 
  - apt-get update -yqq

  - apt-get install -my wget gnupg
  # Upgrade to Node 7
  - curl -sL https://deb.nodesource.com/setup_7.x | bash -

  # Install dependencies
  - apt-get install bzip2 git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq

  # Install php extensions
  - docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache

  # Install Node dependencies.
  # comment this out if you don't have a node dependency
  - npm install
  - npm install -g bower
  - npm install -g gulp-cli

  # Install Composer and project dependencies.
  - curl -sS https://getcomposer.org/installer | php
  - php composer.phar install 

使用php7.0和Laravel 5.3.2

1 个答案:

答案 0 :(得分:1)

我遇到了这个问题。 Mcrypt在PHP 7.2中被弃用。以下是如何解决这个问题:

  image: php:7.2

  before_script:
    # Update packages
    - apt-get update -yqq

    # Install dependencies
    - apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq

    # Install php extensions
    - docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache pcntl

    ....    

    # PHP 7.2 Mcrypt & pcntl
    - pecl install mcrypt-1.0.1
    - docker-php-ext-enable mcrypt

    ....