Search code examples
phpdockercomposer-phpphp-7.1gitpod

"Gitpod" Downgrade default PHP v7.4.3 to 7.1.3 or 7.2


The error I'm facing is on Gitpod with PHP version, so the question is, how can I delete PHP completely from the workspace or replace it? Basically, I want to downgrade it.

I want to replace PHP with an older version. Unfortunately, I’m not able to get rid of the default PHP version 7.4 of the MySQL workspace.

I tried nearly every style of removing it in my .gitpod.Dockerfile file.

I activated the Feature Preview to have sudo support and I uninstalled every PHP version via gitpod dockerfile and ran

sudo apt-get purge ‘php*’

in the command line. It just says that no PHP is installed, but

whereis php

still gives me the output.

php -v

always gives me PHP v7.4

To install another php version is possible (e.g. with brew) but without removing the old one, I don’t know how I could use the new one.

Could someone please tell me, how can I downgrade this PHP version in "GITPOD" by replacing it or some other way?

Edit: this was the code I was trying to run:

FROM gitpod/workspace-mysql

USER root RUN sudo add-apt-repository ppa:ondrej/php RUN sudo apt-get -y update RUN sudo apt-get -y install php7.2 RUN sudo update-alternatives --set php /usr/bin/php7.2 RUN sudo a2dismod php7.4 RUN sudo systemctl restart apache2

USER gitpod

Thanks in advance.

Best Regards


Solution

  • The problem is the install command. because of the script that runs in the background.

    So the solution is running the following command instead of running apt-get install

    install-packages php7.2

    details of the answer could be found in the following thread:

    Downgrade default PHP v7.4.3 to 7.1.3 or 7.2