How To Install php-html-safe on Debian 9

In this tutorial we learn how to install php-html-safe on Debian 9. php-html-safe is strip down all potentially dangerous content within HTML

Introduction

In this tutorial we learn how to install php-html-safe on Debian 9.

What is php-html-safe

php-html-safe is:

This parser strips down all potentially dangerous content within HTML:

  • opening tag without its closing tag
  • closing tag without its opening tag
  • any of these tags: “base”, “basefont”, “head”, “html”, “body”, “applet”, “object”, “iframe”, “frame”, “frameset”, “script”, “layer”, “ilayer”, “embed”, “bgsound”, “link”, “meta”, “style”, “title”, “blink”, “xml”, etc.
  • any of these attributes: on*, data*, dynsrc
  • javascript:/vbscript:/about: etc. protocols
  • expression/behavior etc. in styles
  • any other active content

It also tries to convert code to XHTML valid, but htmltidy is far better solution for this task.

There are three methods to install php-html-safe on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install php-html-safe Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install php-html-safe using apt-get by running the following command:

sudo apt-get -y install php-html-safe

Install php-html-safe Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install php-html-safe using apt by running the following command:

sudo apt -y install php-html-safe

Install php-html-safe Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install php-html-safe using aptitude by running the following command:

sudo aptitude -y install php-html-safe

How To Uninstall php-html-safe on Debian 9

To uninstall only the php-html-safe package we can use the following command:

sudo apt-get remove php-html-safe

Uninstall php-html-safe And Its Dependencies

To uninstall php-html-safe and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove php-html-safe

Remove php-html-safe Configurations and Data

To remove php-html-safe configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge php-html-safe

Remove php-html-safe configuration, data, and all of its dependencies

We can use the following command to remove php-html-safe configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge php-html-safe

Dependencies

php-html-safe have the following dependencies:

References

Summary

In this tutorial we learn how to install php-html-safe package on Debian 9 using different package management tools: apt, apt-get and aptitude.