0

How to install php extension for tidy html on a beanstalk with amazon linux 2?

I have tried the following

commands:
  1-aml-extras-epel:
    command: "amazon-linux-extras install epel -y"
  2-epel:
    command: "yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y"
  3-yum-clean:
    command: "yum clean all"
  4-tidy-php:
    command: "yum install php74-php-tidy.x86_64 -y"

All of the commands run correctly but I get the following error at runtime of php scripts:

Class 'tidy' not found

Alister Bulman
  • 34,482
  • 9
  • 71
  • 110
Michele Carino
  • 1,043
  • 2
  • 11
  • 25

2 Answers2

1

You cannot pull a single package/extension from "remi" repository, you must take the full stack from the same repository.

For a proper configuration, simply follow the Wizard instructions.

Remi Collet
  • 6,198
  • 1
  • 20
  • 25
-1

In the end I forgot to enable the php module·

Here the full beanstalk config file, so I wrote and added the command.

Note 1. this install the module for php 7.4

Note 2. for command 2-epel we have been forced to use the option "ignoreErrors": true, cause otherwise the deploy procedure will fail cause remi results already installed.

files:
  "/usr/local/bin/enable-tidy-php-module.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/bin/bash

      cd /etc/php.d/
      ln -s /etc/opt/remi/php74/php.d/20-tidy.ini 20-tidy.ini
      cd /usr/lib64/php/modules/
      ln -s /opt/remi/php74/root/usr/lib64/php/modules/tidy.so tidy.so
      cd /usr/lib64/php-zts/modules/
      ln -s /opt/remi/php74/root/usr/lib64/php/modules/tidy.so tidy.so
      exit 0

commands:
  1-aml-extras-epel:
    command: "amazon-linux-extras install epel -y"
  2-epel:
    command: "yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y"
    ignoreErrors: true
  3-yum-clean:
    command: "yum clean all"
  4-tidy-php:
    command: "yum install php74-php-tidy.x86_64 -y"
  5-enable-tidy-php:
    command: "/usr/local/bin/enable-tidy-php-module.sh"
Michele Carino
  • 1,043
  • 2
  • 11
  • 25
  • 1
    Please Stop this awfull hack. Don't provide such advice to other users. The proper way is to use the tidy extension from the same stack which already provides the engine and other ext.. – Remi Collet Feb 07 '22 at 10:59
  • @RemiCollet ok, I'm trying to understand, which exact step of commands would you suggest to solve the necessity I'm facing with Amazon Linux 2? – Michele Carino Feb 07 '22 at 11:59
  • 1
    As already said, follow the wizard instructions, to use the full stack from my repository, including most of existing extensions – Remi Collet Feb 07 '22 at 12:50
  • @RemiCollet I would be very happy to use your repository in an idiomatical way and also help others to use it properly. I think that you should consider Amazon Linux 2 in your wizard guidelines since is one of the most used distributions nowdays, and not everyone, me for example, are able to autonomously adapt. – Michele Carino Feb 07 '22 at 13:22