How to Embed a PHP Page in Blogger

Posted by Lasantha Bandara File Under : html

How to Embed a PHP Page in Blogger

Blogger does not support PHP files directly, but you can still display them. If you already have a PHP page hosted on a server, you can show it inside your Blogger blog using a simple <iframe>. This method is perfect for adding tools, forms, or scripts without needing to change how Blogger works. In this guide, I will explain the steps in a simple way.

Step 1: Host your PHP file

Upload your PHP file to a web server that supports PHP. Blogger itself cannot run PHP, so the file must be hosted elsewhere. For example: https://yourdomain.com/tool.php. If your blog uses HTTPS, make sure your PHP page also uses HTTPS.

Step 2: Add an iframe to your blog

Next, embed your PHP page using an iframe. Go to your Blogger dashboard, edit the post or page, switch to HTML view, and paste this code:

<iframe 
src="https://yourdomain.com/tool.php" 
title="Embedded PHP Page"
width="100%" 
height="420" 
loading="lazy"
style="border:0; max-width: 900px; display:block; margin: 0 auto;">
</iframe>

Replace https://yourdomain.com/tool.php with the link to your PHP file. You can change the height and max-width to fit your design.

Step 3: Add it as a gadget (optional)

You can also add the PHP tool in your sidebar or footer as a gadget:

  1. Go to Layout in your Blogger dashboard.
  2. Click Add a Gadget where you want it to show.
  3. Select HTML/JavaScript.
  4. Paste the iframe code and save.

Tips and common issues

  • Blank box? Your PHP host may block embedding with headers like X-Frame-Options. Try another host if this happens.
  • Mixed content warnings Use HTTPS for both your blog and the PHP page.
  • Too short or too tall? Adjust the height value in the iframe code.
  • SEO note Content inside an iframe is not read as part of your blog by search engines. Add some supporting text to help SEO.

Example

Here is an example with a placeholder PHP page URL:

<iframe 
src="https://example.com/my-tool.php" 
title="My PHP Tool"
width="100%" 
height="480" 
loading="lazy"
style="border:0; max-width: 900px; display:block; margin: 0 auto;">
</iframe>

This will display the PHP page inside your Blogger post, centered and clean.

Conclusion

That is all you need to do. Blogger cannot run PHP files itself, but you can display them by embedding the page with an iframe. Just host the PHP file on a proper server, then paste the iframe code into your blog. It is a simple and reliable way to bring dynamic features into Blogger.

5 thoughts on “How to Embed a PHP Page in Blogger

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.