Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Run another PHP from Publii

  • #10922
    Avatar photo[anonymous]

    Hello,

    I want to call a counter.php which is in the same web directory.

    I have entered the following in the custom htlm header area <?php include ‘counter.php’; ?>

    but this does not work. How do I call the counter.php?

    Thanks

    #10923
    Avatar photo[anonymous]

    Normally PHP isn’t executed in .html files, which is what Publii generates. To make PHP run in .html files you can create a .htaccess file in the root directory and use AddHandler as described in this article for example. This isn’t a Publii specific issue.

    #10928
    Avatar photo[anonymous]

    Yes, this is how it works, but it took me a long time to find the right syntax for my provider All-Inkl.com. If anyone is looking for this in the future.
    The support helped me further. The required string is:

    AddHandler php81-cgi .php .php5 .html .htm