doudu7626
2017-12-05 10:02 阅读 108
已采纳

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

I would like to deploy my Laravel project with GitLabCI and docker. I have a yaml file with the following before_script:

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

Its return with this:

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

I tried to install manually the mcrypt with apt-get install following these answers, but nothing worked for me. Cheked this forum post too, but there is no mentioned about this error.

gitlab-ci.yaml file:

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 

Using php7.0 and Laravel 5.3.2

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dslkchyv673627 dslkchyv673627 2018-03-19 14:59

    I ran into this issue. Mcrypt was deprecated in PHP 7.2. Here's how to get around it now:

      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
    
        ....    
    
    点赞 评论 复制链接分享

相关推荐