sabre-io / Baikal

Baïkal is a Calendar+Contacts server
https://sabre.io/baikal/
GNU General Public License v3.0
2.42k stars 281 forks source link

`Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". ` #1251

Closed ericlathrop closed 1 month ago

ericlathrop commented 3 months ago

Baikal version:

Baikal 0.9.5 PHP 8.3.4

Expected behaviour:

Baikal should show its web page.

Current behaviour:

Baikal shows this message: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".

Steps to reproduce:

I'm using the following Dockerfile to build my baikal image:

FROM php:fpm-alpine3.19

ARG version

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
  apk add --no-cache msmtp

COPY msmtp-php.ini /usr/local/etc/php/conf.d/msmtp.ini

RUN \
  mkdir /app && \
  wget -O baikal.zip  https://github.com/sabre-io/Baikal/releases/download/${version}/baikal-${version}.zip && \
  unzip baikal.zip -d /app && \
  mv /app/baikal/* /app && \
  rm -rf /app/baikal && \
  rm -rf /app/config && \
  rm -rf /app/Specific && \
  rm -f baikal.zip

WORKDIR /app

and I'm using the following docker-compose.yml to get the app running with nginx:

version: "3.7"

networks:
  baikal:
  web:
    external: true

services:
  web:
    depends_on:
      - php
    image: nginx:alpine
    labels:
      traefik.docker.network: web
      traefik.enable: "true"
      traefik.http.routers.baikal.rule: Host(`baikal.mydomain.test`)
      traefik.http.routers.baikal.tls: true
      traefik.http.routers.baikal.tls.certresolver: leresolver
      traefik.http.routers.baikal.tls.domains[0].main: "mydomain.dev"
      traefik.http.routers.baikal.tls.domains[0].sans: "*.mydomain.dev"
    networks:
      - baikal
      - web
    restart: always
    volumes:
      - static-content:/app
      - ./nginx.conf:/etc/nginx/conf.d/baikal.conf

  php:
    image: ericlathrop/baikal-php-fpm-7:0.9.5
    networks:
      - baikal
    user: "{{ baikal_user_id.stdout }}:{{ baikal_group_id.stdout }}"
    restart: always
    volumes:
      - static-content:/app
      - ./config:/app/config
      - ./Specific:/app/Specific
      - ./msmtprc:/etc/msmtprc

volumes:
  static-content:

This works fine with 0.9.4. Searching the error message didn't give me much help.

acanton77 commented 2 months ago

This happened to me today after the update to .0.9.5. I'm running PHP 8.0. I went to .....baikal/vendor/composer/platform_check.php and commented out line 8 (below).

if (!(PHP_VERSION_ID >= 80100)) { // $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; }

This WORKED. I was able to bring up the Admin screen.

Eventually I'll update my Linode Ubuntu 20.04 to PHP 8.1.

What is "Composer" and why do we need it? I tried putting in an 'exit' statement at the top of the 'platform_check.php' module but I got the white-screen-of-death when I tried to bring up the Admin system. So I just commented out the one line and it now works.

acanton77 commented 2 months ago

NOT WORKING AGAIN! I updated the server to PHP 8.3.6 and now Admin won't work... I get the white screen of death. I don't know what module is giving it to me. I need to figure out how to turn on errors in PHP via .htaccess and that might help.

Something in Baikal admin does not like PHP 8.3.

UPDATE UPDATE UPDATE

I turned on the errors in .users.ini (for PHP) and I saw the message:

"pdo sqlite could not find driver...."

The white screen of death was because when I updated to PHP 8.3 I failed to install

sudo apt-get install php8.3-sqlite

(Note: For other PHP versions, use sudo apt-get install phpX.Y-sqlite after replacing X.Y with your PHP version number. see: https://help.getastra.com/en/article/how-to-install-sqlite-for-php-on-a-apachenginx-server-1wj96n5/)

Once I did that everything worked again. (I did not have to comment out any code.)

Leepic commented 1 month ago

I've the same issue after upgrading from 0.9.4 to 0.9.5 using PHP 7.4.33 (Debian 11).

Workaround in vendor/composer/platform_check.php :

-if (!(PHP_VERSION_ID >= 80100)) {
+// if (!(PHP_VERSION_ID >= 80100)) {
+// See: https://github.com/sabre-io/Baikal/issues/1251
+if (!(PHP_VERSION_ID >= 70200)) {

Baïkal is marked supported by PHP 7.4, I think that this bug was introduce when upgrading symfony/yaml from ^3.4 to ^5.4 because symfony/yaml added symfony/deprecation-contracts version ^3" as a new requirement and symfony/deprecation-contracts require PHP ^8.1 in version 3.5.0.

Downgrading symfony/yaml from ^5.4 to ^5.3 in composer.json will fix this bug (not tested).

acanton77 commented 1 month ago

I've heard that Baikal is going to be replaced by some new Sabre front-end system, but I don't know any more than that. Baikal has worked fine for me. While I use iCloud as my primary address book with BusyContacts (on Mac) as the front end, I also have two Baikal servers... on two different hosting companies. Busy Contacts does a good job keeping everything synced to the iCloud "master."

phil-davis commented 1 month ago

@Leepic when I have PHP 7.4 and do composer install in Baikal I get: symfony/yaml v5.4.39

And that has:

            "require": {
                "php": ">=7.2.5",
                "symfony/deprecation-contracts": "^2.1|^3",
                "symfony/polyfill-ctype": "^1.8"
            },

That allows symfony/deprecation-contracts major version 2 or 3 to be used. composer selects symfony/deprecation-contracts v2.5.3

It is working for me.

ByteHamster commented 1 month ago

I think the problem is that I created the release builds (for people not using composer) on a machine with a more recent php version. For the release builds we should instruct composer to use the lowest supported version. Working on a PR now.