João Sousa
João Sousa

Reputation: 1

PHP on Blogger not working

I have a list of links and each one corresponds to a specific song. I want to count the number of clicks that each link receives.

I thought of creating two PHP files: one for the database credentials and another to write on the database itself. Before coding those files I coded a PHP file only echoing "Hello World" and tried to use it in my page to see if it would work. I searched for tutorials in order to learn how to host PHP files using Google Drive and how to embed PHP files on Blogger and managed to find out how to do that.

But now I'm having an issue: after embedding the code on some post, everytime I open it, some file is automaticaly downloaded. I opened it with Notepad++ and it turns out that that page is the PHP file but in some weird format. Do you know if I am doing something wrong and how to fix it?

Just to let you aware of it, this is the code:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        echo "Hello World";
        ?>
    </body>
</html>

Upvotes: 0

Views: 818

Answers (2)

Ander Morales
Ander Morales

Reputation: 139

Blogger only support HTML, CSS, and Javascript inside your template. PHP needs webserver such as apache/nginx and php processor to run, and it's not provided by blogger system.

If you want to run PHP, the only way to do that is host your PHP file in hosting that supported PHP, then call your PHP by javascript in blogger, but it's not easy task. You will need an expert to do that.

Upvotes: 0

ceejayoz
ceejayoz

Reputation: 180075

Blogger does not permit you to run PHP on their service. Google Drive won't run it either.

Upvotes: 1

Related Questions