Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xDebug v3 is being installed on workspace #2794

Closed
jonpage999 opened this issue Dec 13, 2020 · 2 comments
Closed

xDebug v3 is being installed on workspace #2794

jonpage999 opened this issue Dec 13, 2020 · 2 comments

Comments

@jonpage999
Copy link
Contributor

Description:

xDebug v3 is being installed on workspace instances but has xDebug v2 ini files baked into the process.

Expected Behavior:

Right now:
That nothing should have changed since before v3 launched, and the latest v2 would be installed.

Later:
That v3 is an installable option, with appropriate ini files.

Context information:

Output of git rev-parse HEAD

6221aaf5f0ca671e12b4cc8229ff5dcb311add94

Steps to reproduce the issue:

  1. Clone the latest laradock
  2. Change the "WORKSPACE_INSTALL_XDEBUG" env variable to true.
  3. docker-compose up -d workspace
  4. docker-compose exec workspace
  5. php -v
  6. Check output to see that xDebug v3.0.1 (true today) is installed.
@jonpage999
Copy link
Contributor Author

jonpage999 commented Dec 13, 2020

I've tested a solution to this issue on PHP 7.2, 7.3 and 7.4. Workspace is slow to build so I haven't confirmed earlier versions as yet, I'll aim to create a PR when I have.

In the "workspace/Dockerfile" you can replace this section:

RUN if [ ${INSTALL_XDEBUG} = true ]; then \
    # Load the xdebug extension only with phpunit commands
    apt-get install -y php${LARADOCK_PHP_VERSION}-xdebug && \
    sed -i 's/^;//g' /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini \
;fi

Instead use a block largely taken from the php-fpm build:

RUN if [ ${INSTALL_XDEBUG} = true ]; then \
  # Install the xdebug extension
  if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
    pecl install xdebug-2.5.5; \
  else \
    if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \
      pecl install xdebug-2.9.0; \
    else \
      if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \
        pecl install xdebug-2.9.8; \
      else \
        if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
          pecl install xdebug-2.9.8; \
        else \
          #pecl install xdebug; \
          echo "xDebug 3 required, not supported."; \
        fi \
      fi \
    fi \
  fi && \
  echo "zend_extension=xdebug.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini \
;fi

Edited to correct a lost semi-colon.

@jonpage999
Copy link
Contributor Author

I have checked this and confirmed that it works on all currently supported versions (5.6 - 7.4). I will make a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant