Tag: zend

Running Zend Framework Applications in AppFog

AppFog is quite a popular polyglot PaaS (Platform as a Service) provider and it comes with a generous free plan for the developers. With the free plan, you can host as many apps as you want with 2GB ram limit, database from 100 to 1GB limit and so on. I’ve been using AppFog since the beginning and I must say that I really love their service.

Recently, I was looking for a solution on how to host a Zend Framework based application in AppFog. The main problem was that the url must point to the /public folder inside the app andΒ  from there it is initialized.Β  After searching for some time, I found the clue in AppFog’s doumentation which is you’ll have to redirect all the traffic from the parent domain to the /public/index.php file using the URL rewrite rules. Here is the content of the .htaccess file that you will have to keep in the application root directory.

[sourcecode lang=”shell”]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.tld$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.tld$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
[/sourcecode]

This is mainly it. Once you have placed the .htaccess file in the root folder of your application, it will work flawlessly.

Shameless Plug

We develop beautiful Admin Panel templates for the web application developers. Our recent product is “Bolt” which is responsive and built on top of Twitter’s bootstrap. Give it a try and let us know how do you like it.

Bolt Responsive Admin Panel Template for Developers
Bolt Responsive Admin Panel Template for Developers

 

 

Developing PHP applications in the cloud with these free cloud hosting providers

CPU and Disk-space are cheap these days. And the more cheaper they become, cloud companies are coming with more exciting deals for you. Some of them are offered in “Freemium” model, some of them are free forever and some of them are like trial plans which is free for a certain period of time. I will be focusing on some of these free cloud hosting options available out there. One thing to note before you proceed – these free cloud hosting options are very good to develop and test your applications (in dev+staging environment) and it may not be wise to deploy the production version of your application with any free plan (Except Amazon AWS’s free tier, its production ready).

Amazon AWS: Amazon AWS is not only a cloud hosting provider but there are LOT MORE under the hood. They offer you cloud servers, messaging gateway, payment service, CDN and many more. Now there is a sweet promotion going on for all new AWS customers. Just register a new account and you will be getting the followings for free, for ONE YEAR long. No catch!

  • 750 hours of Amazon EC2 Linux Micro Instance usage (613 MB of memory and 32-bit and 64-bit platform support) – enough hours to run continuously each month*
  • 750 hours of an Elastic Load Balancer plus 15 GB data processing*
  • 10 GB of Amazon Elastic Block Storage, plus 1 million I/Os, 1 GB of snapshot storage, 10,000 snapshot Get Requests and 1,000 snapshot Put Requests*
  • 5 GB of Amazon S3 standard storage, 20,000 Get Requests, and 2,000 Put Requests*
  • 15 GB of bandwidth out aggregated across all AWS services*
  • 25 Amazon SimpleDB Machine Hours and 1 GB of Storage**
  • 100,000 Requests of Amazon Simple Queue Service**
  • 100,000 Requests, 100,000 HTTP notifications and 1,000 email notifications for Amazon Simple Notification Service**
  • 10 Amazon Cloudwatch metrics, 10 alarms, and 1,000,000 API requests**

Now in above list ** means that upto this quota, it will always remain free forever, and * means that this service is free for one full year starting from the day of your registration.

Hosting on Amazon’s EC2 platform might be a little tiresome for completely new-comers who has limited knowledge on Linux, SSH and Private/Public key management but this article will help you to start quickly. This is one of the most lucrative among all others I will be mentioning in this article.

By the way, you need a valid credit card to register in Amazon AWS program.

PHPFog: There is a new kid in town, PHPFog. Though they are actually developed on top of Amazon’s AWS platform to help developers manage scaling, deploying etc in a painless and easy, everything under the hood style and they are doing good. PHPFog offers you 100MB of free hosting, 15 GB of bandwidth with unmentioned RAM and CPU for six months. No credit card is required to start. Moreover, they made it fairly easy for you to deploy any Zend-Framework or Drupal or Joomla or WordPress based application in the cloud with their pre-configured containers. This is really a decent package to kickstart developing an application πŸ™‚

To start with PHPFog, you need to know git because source code deployment is completely managed using git and git hooks. You may also need to understand how to manage multiple SSH keypair in your machine to get started with PHPFog. Check out PHPFog at http://phpfog.com

PHPCloud This is something VERY new and I heard about it in last week, when one of my colleagues forwarded me the link. At this moment it is invitation based but dont panic, getting invitation will take hardly a day or two. PHPCloud is backed by Zend on top of Zend Application Fabric platform. Once you are done testing your application in phpcloud, you can keep it either here or deploy to other cloud providers like Amazon EC2, Rackspace or Rightscale. The configuration of the free tier is not mentioned but as far as I have heard, the free container will remain free forever. Please check out PHPCloud at http://www.phpcloud.com

Heroku: One of the prominent cloud platform provider for Ruby developers collaborated with Facebook last month and started providing free container to develop Facebook applications using PHP on top of their amazing platform. Heroku is good, reliable and it comes with thousands of add-on which you will need to buy while the core container is free for PHP Developers. Check out Heroku’s offer at devcenter.heroku.com/articles/facebook

I hope you find this article helpful for developing and hosting your php application in the cloud, and in the same time check the service they offered and their quality. Enjoy!

Shameless Promotion: If you are looking for any beautiful admin panel theme for your Web Application, then you can check out our Brand new and Shiny admin template Muse at Themeforest from our Themio team.

Muse, Professional and Responsive Admin Panel Template from Themio
Muse, Professional and Responsive Admin Panel Template from Themio

Using Google WorldMap visualization component in your applications

Its really hard to find a good flash based world map component to use in your web applications. They are either too complex to add or they cost quite a lot. And even sometime if you pay that, its tough to customize the chart as you want it to look like. But you know there is someone called “Uncle G” (i.e google) here who has almost all the components in his Pandora’s box. So lets see how can we use the geomap component from their Visualization Library.

First we need to create a datatable which will act as a data source for this world map, as usual like all other google visualization component.

[source lang=’javascript’]
var data = new google.visualization.DataTable();
data.addRows(5);
data.addColumn(‘string’, ‘Country’);
data.addColumn(‘number’, ‘Number of ZCEs’);
data.setValue(0, 0, ‘Bangladesh’);
data.setValue(0, 1, 19);
data.setValue(1, 0, ‘India’);
data.setValue(1, 1, 150);
data.setValue(2, 0, ‘Pakistan’);
data.setValue(2, 1, 4);
data.setValue(3, 0, ‘Nepal’);
data.setValue(3, 1, 5);
data.setValue(4, 0, ‘Sri Lanka’);
data.setValue(4, 1, 7);
[/source]

now we will initialize the google visualization framework and draw this component using this data source

[source lang=’javascript’]
var geomap = new google.visualization.GeoMap(document.getElementById(‘‘));
geomap.draw(data, null);
[/source]

but wait, we are not done yet – to make sure that everything works properly, we need to wrap all of these code inside a function (for example name this function as drawGeoMap) and we will use that function as a callback to draw this map. and of course, we need to load the google visualization library and geomap component first

so here is the complete code of this
[source lang=’javascript’]







[/source]

you can check the demo at http://sandbox.ofhas.in/geomapv1.php

it will display a world map with highlighted countries like below
Geomap V 1

but wait – lets make ca nifty change and add event listeners to it. we will add event listeners in such a way so that whenever users click on any country in the map, it will take you to zend yellow page corresponding to that country πŸ™‚ that will make it really an useful component :). here is the code

[source lang=’javascript’]







[/source]

check the demo at http://sandbox.ofhas.in/geomapv2.php

now you can click on any country and it will open a new tab with that particular country pre selected – and you can see who are the zend certified engineers from that country. i hope you’ve liked this :). Thanks goes the theam Visualization team at google for creating these awesome components and to make them free for use

For reference – check out geomap reference at google code at http://code.google.com/apis/visualization/documentation/gallery/geomap.html. you can do many other cool things like displaying only US states map or Canadian States map with this πŸ™‚