How to Easily Add PHP Codes in Blogger

Advertisements
PHP is considered as the most powerful computer language that makes things happen with the glimpse of seconds. However, PHP is not supported by Blogger or BlogSpot running platform which makes it extremely difficult to customize and implement some new latest developments, but there are still some ways through which you can add PHP codes in your Blogger enabled Website. Though, the results are not 100%, but it is far better than not having a PHP code on your blogger site. In this article, we will show you how to add PHP codes in Blogger.

Step#1: Creating a PHP File:

Before you can add PHP Codes in blogger, you have to first create a PHP file in which you have to use all the PHP codes that you would like to use.  However, make sure that the file is free from errors otherwise things would not look good. Following is the simple Hello World PHP code example, just for a basic guideline for some beginners

<?php
echo '<p>Hello World</p>';
 ?>

After creating the file with all your desired codes make sure you save it in .PHP extension. For example, mybloggerlab.php, you can use NotePad++ for writing codes because it is the only FREE standard developing tool.

Step#2: Hosting a PHP File:

Since, blogger does not allow you to host any kind of files like PHP, HTML or CSS. Therefore, you have to either host it on your hosting (if you have) or you can use Google Drive to host them for FREE. We have already written a detailed tutorial on It, so read it here.

You can also use Dropbox, and many other free hosting services but certainly they are not better than the features and reliability of Google Drive.

Step#3: Adding  PHP Codes in Blogger

After creating and hosting the PHP file, login into your Blogger account. Once logged in, head over to the dashboard and select the blog on which you would like to add PHP Codes. Now it depends on your needs whether you want to add the PHP code in posts, pages, sidebar or footer. Just paste the following code anywhere you would like to display the PHP file.

<object width="400" height="300" type="text/html" data=" your-file.php"></object>

Don’t forget to replace your-file.php with the URL of your own PHP file that you may have got while hosting it on services like Google Drive Dropbox and etc.

Congratulations: You have successfully added PHP codes to blogger. Go and check your blog to see if things are working as planned. Let us know, if you have a better way of doing this job.

We hope this tutorial has helped you in learning how to add PHP codes in blogger. Still, this is not the most accurate way because we are just using a iFrame technique to include the codes. Blogger needs to think more on making its platform friendly for the developers so that they can bring awesomeness to their blogs and websites.

Advertisements

The Editorial Team of MyBloggerLab consists of a group of Professional Blogger geeks Led by Syed Faizan Ali (Founder of MyBloggerLab).

Comment With:
OR
Choose Wisely!

34 comments

October 1, 2013 at 6:40 PM

wow dear its amazing, now we will be able to use php on blogger, but for that we use other hosting sites for upload php files.

October 1, 2013 at 10:19 PM

Really good Explanation.!
It's good to making contact form or other scripts.
But still we have't access to database to make things dynamic.

October 2, 2013 at 8:24 AM

You're wrong, it should be PHP is the most powerful web language when it comes to computer it's C.

Anonymous
October 2, 2013 at 5:06 PM

Perfect... now blogger full customized

October 11, 2013 at 7:44 AM

Great Idea.

October 20, 2013 at 3:43 AM

Nice sharing brother.,...

October 20, 2013 at 10:52 AM

When i host this file in Google drive, the file is downloaded, it isn't executed.

Editorial Team MOD
October 20, 2013 at 10:16 PM

Check this tutorial

http://www.mybloggerlab.com/2013/04/how-to-host-css-or-javascript-files-in-blogger-using-google-drive.html

October 21, 2013 at 1:33 PM

you can't host php on google drive!, actually you can just host php file, but php is not a script, but it's like a processor, so google drive won't run it...

October 22, 2013 at 11:44 AM

i'm very very like this post because is very helpful form e because i'm a designer and developers of blogger. but can i create a user or other dashbord like as wordpress, plz tell me??
www.bouyardane.com

October 23, 2013 at 7:48 AM

very good ! thanks 4 sharing this useful tutorial :-)

October 25, 2013 at 6:04 AM

Friend Nice Tutorial. I am injoy to read this article.

Editorial Team MOD
October 27, 2013 at 4:41 PM

No, that's not possible

October 29, 2013 at 1:09 AM

Can we process html forms... if yes what we have to use in action="" or action="">

Editorial Team MOD
November 3, 2013 at 4:24 AM

Yes, but you have to host that Form on some other URL and then you can embed it

December 5, 2013 at 3:14 AM

Very nice post...Thanks for sharing this.

December 24, 2013 at 4:47 AM

hmm really..

December 24, 2013 at 4:48 AM

nice

March 3, 2014 at 11:52 PM

super

March 24, 2014 at 2:48 AM

nice tutorial...

April 14, 2014 at 10:17 AM

That is why I like Mybloggerlab. The way you have explained is really quite amazing. Thanks for sharing such a great article with us.

Editorial Team MOD
April 15, 2014 at 5:57 AM

Glad you liked it

April 27, 2014 at 12:01 PM

What about connection to MySQL?

Anonymous
August 10, 2014 at 5:37 AM

brother this is my application http://cs506practical.blogspot.com/p/assignment-no-4.html please check this and tell me how to make database and insert data into database

September 15, 2014 at 1:05 PM

Good post for simple PHP.
BUT - There is an issue with Google Drive.
IMO, the advantage of PHP over JavaScript is that user cannot see you code. But in Google Drive, whoever copied the data="..." URL, can download your raw PHP code. (So why bother with visible PHP, when you can use visible JavaScript instead?)
So, Google Drive is good for .js, .css, .jpg or whatever, but for PHP I'd recommend to use a free or paid PHP hosting.
(Also, it seams that Google Drive have some traffic limitation for frequently visited files.)

November 22, 2014 at 6:41 PM

I want to add ajax php star rating system to my posts in this way. How to do it?

Editorial Team MOD
November 25, 2014 at 11:14 PM

Here's a tutorial on how to add Star rating in Blogger

http://www.mybloggerlab.com/2014/02/how-to-add-post-rating-system-in-blogger.html

January 19, 2015 at 11:12 PM

If i want to run php script? how do i run it on blogger?

g
November 6, 2015 at 11:31 PM

This is cool stuff

November 11, 2015 at 2:39 PM

Blogger does not allow saving of php file. Not sure how to proceed.

January 6, 2016 at 2:50 PM

hello,

this is the statement you made in your post...

"Don’t forget to replace your-file.php with the URL of your own PHP file that you may have got while hosting it on services like Google Drive Dropbox and etc."

how to get the URL of the php file in the Google Drive?

Editorial Team MOD
January 7, 2016 at 2:16 AM

Here is the tutorial

http://www.mybloggerlab.com/2013/04/how-to-host-css-or-javascript-files-in-blogger-using-google-drive.html

February 12, 2016 at 5:46 AM

i performed all the steps to perform it but a message appear on screen "a plug in is required to play this content"

August 18, 2016 at 12:53 PM

Ahmmm .. Really good.
Try www.000webhost.com site for php upload , Its free.. 😀

Post a Comment

We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually by our human reviewers according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden. Let’s enjoy a personal and evocative conversation.

Helping You to do Cool Things With Blogger Since 2012™.

© Copyright 2012 - 2018. MBL Networks, All Rights are Strictly Reserved.