Interact PHP - comment system

Code - 17-08-2018


Interact is a simple PHP open-source comment system that can be added to any website in minutes to improve interactivity and user's involvement. Client-side, it is very lightweight (<6KB CSS and JS combined) and intuitive (no logins, no cookies,...). Server-side, it is very easy to setup, manage and even customize to fit your needs.

Interact PHP with the modern interface Interact PHP with the default theme

Similarly to its older brother HashOver, Interact does not use an SQL database but stores comments as XML files. Many third-party comment systems like Disqus, IntenseDebate, Livefyre, Facebook Comments and Google+ Comments, suffer from these problems and impose them and many other restrictions onto their users, meaning you and your website's visitors.


  • No dependency.
  • Fast and convenient for your users with responsive design.
  • Very simple setup: no database to configure, just install it and add 2 lines of PHP where you want your comment section to be.
  • Easily customizable style and behavior to match the look & feel of your website.
  • Anti-Spam system using Google's reCAPTCHA v2 (optional).
  • Pure JS (no JQuery required).
  • Secure by design.
  • Inline Markdown syntax support in comments (bold, italics, strike-through and inline code) (can be disabled).
  • Open-source (MIT license).
  • W3C compliant and follows accessibility rules.

Installation and setup

Requirements: PHP≥5, php-xml.

  1. Download/clone Interact on GitHub.
  2. Put the "Interact_PHP" folder under your website's root (or relocate the folder where you want and change the LIBRARY_ROOT setting accordingly).
  3. Optional: customize Interact's behavior to your needs by editing the Interact_PHP/settings.php file and/or the Interact_PHP/strings.xml.
  4. Give the directory that will contain the comments 777 permission (chmod -R 777 path/to/interact_php/Comments). Alternatively, chown the folder to the user that is configured to execute PHP scripts as, for example "www-data". And then simply give the "path/to/Interact_PHP/Comments" directory permissions "755".

Hurray, Interact is ready to go! To add a comment section to a page, just insert the following PHP in any page:


The parameter <some-id-such-as-article-title> is what will be used to associate the comments with this form. If you call \Interact_PHP\Interact_PHP() without an argument, it creates an ID from the URL, but this is not recommended.

You can call \Interact_PHP\Interact_PHP() multiple times per page if you need multiple comment forms (e.g. a page with several articles).

Parameters and customization

All of the core parameters of Interact are in the settings.php file. There are a lot of comments to assist you in the configuration process. Some of them, like enabling reCAPTCHA are highly recommended.

Look and feel

Several CSS files are included with Interact PHP. If you want to add your own style, copy an existing CSS file to get started... and commit it on GitHub if you want to contribute to Interact's ongoing development!

Interact PHP with various CSS Various included themes with Interact PHP


Interact PHP supports full internationalization: all user-visible strings are stored in a "string.xml" file. You can edit this file to match your website or add translations, and call \Interact_PHP\Interact_PHP("<some-id-such-as-article-title>", "language") with another parameter "language" that is the desired language to display.

If you need a single display language, you can just customize the "default" language.

Admin interface

If you set up a value for ADMIN_PASSWORD, Interact PHP enables a very simple admin interface that allows to delete and promote comments (to show an "Author" badge).

Interact PHP's admin interface The administration interface for Interact PHP

It is accessible from the url: https://your_website_url/path/to/interact_php/admin/admin.php.

Note about security: Interact PHP only stores a hash of the password, and the absolute worst that can happen if a bad actor were to gain access would be the ability to remove comments, which is negated by doing backups of the comment files (anyway recommended). Regardless, I would highly advise only enabling this admin interface if the two conditions below are met:

  1. Your website uses HTTPS,
  2. You either enabled the reCAPTCHA anti-spam system for Interact PHP and/or you have another way to prevent brute-forcing on your website.


This section describes the various problems you may encounter while installing/using Interact. If you don't find a solution here, please add a GitHub issue.

  • I can't add comments

You should check the permissions of the folder containing the comments (Interact/Comments by default). The PHP user must be able to write there. Setting 777 works (chmod -R 777 Comments).

If the libxml PHP library is not enabled, installing should fix the issue (e.g. sudo apt-get install php-xml, restart Apache when completed).

  • The CSS does not load

The path of the library relative to the root of your website is probably incorrect. Make sure it matches with the value in settings.php. By default, it is /interact_php.

  • I am getting reCAPTCHA errors even after checking the box

You need to make sure that your reCAPTACHA public and secret keys are correct. Interact uses reCAPTCHA v2. More info at

Future features/work in progress

This is the list of future features, by priority:

  • New feature: collapsible comment box if the comment box height is more than N pixels or N comments
  • New feature: optional hidden email field to allow the webmaster to contact users

Please submit a GitHub issue for feature requests or bug reports.


This library is published under MIT license.


What is on your mind?

  • #1 leo


    on April 11 2019, 2:39

  • #2

    Simple and useful 测试中文

    on April 11 2019, 2:44

  • #3 Author Charles

    Test comment:
    This is a Markdown syntax test.
    Markdown is bad.
    [MD XSS](javascript:alert("xss"))
    <script>alert("XSS test!");</script>

    on May 12 2019, 2:57

  • #4 Pierrot

    Hi Charles,
    and thank you for sharing InteractPHP.
    There's a little error at line 7 in setting.php : it's written interact
    php instead of interact_PHP...
    Unfortunatly, I couldn't make it work anyway because my site is on a vm behind Nginx reverse proxy. This gives me an error of mixed content with https when I click on "Submit". It 's written "Sending message..." and no more...
    Do you have any advice to help me to fix this little problem ?
    Thanks on advance.

    on April 3 2023, 17:33

  • #5 Drozsam

    <a href=>restauration de l'émail des bains</a>

    on July 9 2023, 4:47

  • #6 KennethCoida

    <a href=>Réparation des baignoires</a>

    on July 20 2023, 23:55

  • #7 Tilly

    What's up to every one, it's actually a good for me to pay
    a visit this website, it consists of valuable Information. darknet markets 2023

    on August 19 2023, 1:46

  • #8

    do you already know the vaccines you should give to your new babies come on and visit my site to find out

    on September 27 2023, 11:10

  • #9

    do you already know the vaccines you should give to your new babies come on and visit my site to find out

    on September 27 2023, 11:10

  Back to projects

Related articles