PHP is getting higher rank in web languages having large number of built-in functionalities like visitor counter. Google aren’t allow blogger to insert PHP code in blog but developers are curious on how to add
PHP codes in Blogger. The platform supports XML and it’s difficult to implement. Beside learning XML a developer can add PHP code in blogger. Learn how to add PHP codes in blogger.
PHP Codes in Blogger
Beside XML you can now
run PHP code in blogger, an embed object works perfect which displayed in iframe. Remember the frame will load from external hosting . You can call it PHP blogger magic but PHP scripts in blogger is tricky work.
1. Create PHP File:
Create a PHP file which includes all your functionality so that. Below is an example of simple Hello TwoClock file. You can then add additional PHP code functionality. Remember if your code contains any error then a blank object will be displayed. Do not make any mistake in PHP file.
<?php echo '<h3>Hello TwoClock.</h3>'; ?>
Open your favorite text editor (e.g. notepad or notepad++). Save your file with the name example.php. Next step is to Upload it on server so it works like charm.
2. Upload on Web Host
Blogger do not support any script file or style upload. Manage your own hosting server either free or paid depends on you. Since 2016 Google Drive support and embed but now it’s closed. You need to choose a third party hosting to add PHP scripts in blogger. We recommended you these hosting websites. Zymic Hosting OR 000Webhost.
3. PHP Scripts in Blogger (embed)
After creating a file, you must upload it on web hosting server via FTP Client (e.g file zilla). Next step is to choose where you want to display the PHP code in blogger page or post. Add the below line of code in HTML section of your blogger and enjoy the blogger platform supports PHP.
<object width="400" height="300" type="text/html" data="yourfile.php"></object>
Remember to replace yourfile.php with the URL of your hosting file. Once your URL loaded you can view file but if any error in your PHP or URL then it will not work.
Remember again that PHP doesn’t fully supported by Blogger so avoid making any silly mistakes.