|By Hovhannes Avoyan||
|September 13, 2012 11:16 AM EDT||
This brief tutorial will enable web application developers to harness the power of cloud computing database, Xeround, with the best PHP MVC framework in town, CodeIgniter.
Xeround is an Israeli web startup, launched back in 2005. It specializes in cloud database software technologies, operating in the PaaS domain. Xeround is primarily known for its MySQL cloud database, which it provides with a seamless frontend application. Its unique selling point is the ability to easily scale MySQL application on multiple platforms like Amazon EC2 and Rackspace. Xeround is positioned well in the MySQL cloud database market. Xeround’s basic MySQL cloud database plan is free and pretty fast.
CodeIgniter on the other hand is an Open Source PHP MVC (Model View Controller) framework used to make high end and enterprise level web applications. The framework uses a popular MVC software design pattern, popular with most of the top web developers today. The high points of using CodeIgniter as your web application framework are massive, such as highly organized code, rapid application development and plethora of in built tools.
What will this tutorial teach you?
This tutorial aims to teach you to setup up a basic CodeIgniter application in conjunction with the Xeround cloud database, powered by Oracle’s MySQL.
What will this tutorial NOT teach you?
This tutorial will NOT teach you to use CodeIgniter, MySQL, Phpmyadmin, FTP, HTML, CSS, XAMPP or the web stack.
So in a nutshell?
It rather enables you to learn the processes involved in helping you setup your next web application using CodeIgniter with a Xeround backend.
What will you need?
- An Internet connection, preferably fast.
- A working installation of XAMPP. You can download one here.
Setting up CodeIgniter
With your XAMPP already installed and configured on your computer (Windows, Mac or Linux), you active it by following these steps.
- Launch XAMPP application by clicking on this icon on your desktop.
- Now, ensure the first two features on the control panel are active. In order to enable Apache and MySQL, just click the Start buttons beside them and their status-es should turn green. That’s it. You’re on localhost.
- Now, open up your favorite browser, preferably Google Chrome and type in the following text in the address bar: localhost. If that doesn’t work, type in 127.0.0.1. If everything went well previously, you should see something like this. (Obviously, if you have Linux or Windows, it will mention XAMPP for X OS).
Now, lets setup CodeIgniter. The first thing you should do is visiting Ellis Lab’s CodeIgniter page by click here. When on the home page, click on the download button on the right side. Now its time to unzip.
Once the compressed file is unzipped, name it anything you like. We have named it “CodeIgniterApp”. It is important to clean the folder of any junk, by deleting the license.txt and the user guide files. You wont need those.
To enable your CodeIgniter app to work on the localhost, which is a simulation of a website on a host, you need to copy it to your htdocs.
To do this, follow the directory structure to access your htdocs folder.
Now, just drag and drop the “CodeIgniterApp” folder into htdocs. To ensure everything went fine, open up your browser and type in localhost/CodeIgniterApp. If successful, you should see this page and probably celebrate.
At this point in time, the CodeIgniter has been successfully setup. However, it doesn’t require a database to function just to load up a simple dynamic Welcome page. As the objective of our tutorial is to use CodeIgniter with Xeround, let’s take a break from the CodeIgniter side of things and create an Account on Xeround.
Setting up Xeround
As mentioned before, Xeround offers cloud database services for MySQL that are highly scalable with top notch companies providing instances such as Amazon and Rackspace.
Note: This part of the tutorial will create a sample Xeround account. The username and password will not be disclosed.
- First things first. Visit http://xeround.com/ to access the Xeround site. The home page pretty much summarizes the things we have discussed so far, such as scalability, availability and simplicity.
- Using the navigation bar on top, click sign up. Alternatively, you can click here. Enter your details and in the ‘Expected DB Size’ field, select Less than 0.5 GB. This is well good enough for a starter.
- Now, check your email for the confirmation link that was sent to you. At this point in time, you don’t have to choose the password. That comes later when you click the confirmation link.
- Once you have set the password after clicking the confirmation link, you will be welcomed to the Xeround’s primary dashboard. This can be accessed at https://cloud.xeround.com as well.
- To create your new Cloud Database in minutes, follow these steps:
- Choose to create your database Instance.
- Choose the free 10 MB Xeround FREE plan. You get:
a) Shared Environment
b) High Availability Guaranteed
c) Throughput: up to 1MB/s
d) Connections: up to 5
- Now you will be asked to choose your Data Centre. We recommend Amazon EC2. It’s the best in the business right now. Highly reliable!
- The last step for creating your DB Instance asks you to fill in some crucial details. These may be the most important details of all. They are essential to get your web application up and running on a MySQL backend.
Here is a sample of what we’ve filled in for this tutorial account:
- Once every detail has been carefully filled in and stored in your memory, remember to do one last thing. Yes, you guessed it right. Click the big blue button that says Create.
- Once you have clicked Create, a dialog box will show up saying “DB Instance creation is in progress”. Just close. The DB Instance has been created by now.
- The DB Management Dashboard now looks something like this, as shown in the image below. Explaining all the features of the dashboard is beyond the scope of this tutorial.
- Now, click the link under external DNS Hostname and login to your Phpmyadmin. Once there, create yourself a database. We named ours ‘neil’. At this moment, just take note of your: Database name, user, pass and external DNS Hostname
Connecting Xeround with CodeIgniter
Now that we have our Xeround database setup, it is time to connect the database with CodeIgniter.
- Open the CodeIgniterApp folder that you placed earlier in the htdocs directory. Access the database.phpfile by following the directory structure: CodeIgniterApp/application/config/database.php
- Once you are in the file database.php, scroll down to line 51. Can you see the fields for hostname, username, password and database?
Currently, they are set to localhost but since we want Xeround, we would need to add the details in the blank spaces using the notes we took earlier. By the way, Xeround works on localhost and web!
So based on the tutorial account details, it looks like this once its filled:
$db['default']['hostname'] = instance26267.db.xeround.com:16438;
$db['default']['username'] = ‘user’;
$db['default']['password'] = ‘pass’;
$db['default']['database'] = ‘neil’;
Note: Although you do not have access to the tutorial Xeround account we created, you can still use these database instance details. However, we recommend you create your own. This is only for demonstration purposes.
Tip: In order to avoid lagging, it is better to disable persistent connections within your CodeIgniter application by editing line 57 of database.php. You simply have to set $db['default']['pconnect'] = FALSE; to false. This ensures that there are no lags, since there is a limit of 5 connections in the Xeround FREE plan.
Congratulations. You have successfully completed the essential portion of the tutorial. You have connected your Xeround Cloud Database with your CodeIgniter application. What’s next? Well, its time for some testing.
Testing your application
Lets create a sample table structure.
- Go to application/controllers/ and create a controller: tables.php.
- Add the following code and save it. The code is already supplied in the zip folder attached with this tutorial (namely CodeIgniterApp.zip).
So what this does is basically creates a Controller called Tables, loads the DBForge class of CodeIgniter (used to create tables) and creates a table called Test_Table. If returns messages on the success or failure.
- Run the tables’ controller by type in the following address in your favorite browser’s address bar: http://localhost/CodeIgniterApp/index.php/tables
- You should now see a message on your browser that says that the table “Test Table” has been created successfully. You can even confirm this by going back to your Phpmyadmin dashboard.
Now lets try adding some real world data into our table. To do that, we will create a small application that stores users’ first and last name. Since the scope of the tutorial is not to teach CodeIgniter or programming whatsoever, the files have been supplied to enable you to learn. The end result of the small application is shown below.
Oh by the way, don’t forget to turn on the following autoload.php options by going into CodeIgniterApp/application/config/autoload.php:
You can get the sample code used in this article hereShare Now:
SYS-CON Events announced today that ContentMX, the marketing technology and services company with a singular mission to increase engagement and drive more conversations for enterprise, channel and SMB technology marketers, has been named “Sponsor & Exhibitor Lounge Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York City, New York. “CloudExpo is a great opportunity to start a conversation with new prospects, but what happens after the...
May. 28, 2016 07:00 PM EDT Reads: 1,241
The IoTs will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, will demonstrate how to move beyond today's coding paradigm and share the must-have mindsets for removing complexity from the development proc...
May. 28, 2016 07:00 PM EDT Reads: 1,950
SYS-CON Events announced today BZ Media LLC has been named “Media Sponsor” of SYS-CON's 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. BZ Media LLC is a high-tech media company that produces technical conferences and expositions, and publishes a magazine, newsletters and websites in the software development, SharePoint, mobile development and Commercial Drone markets.
May. 28, 2016 07:00 PM EDT Reads: 3,566
SYS-CON Events announced today that Alert Logic, Inc., the leading provider of Security-as-a-Service solutions for the cloud, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Alert Logic, Inc., provides Security-as-a-Service for on-premises, cloud, and hybrid infrastructures, delivering deep security insight and continuous protection for customers at a lower cost than traditional security solutions. Ful...
May. 28, 2016 06:45 PM EDT Reads: 2,847
SYS-CON Events announced today that MangoApps will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. MangoApps provides modern company intranets and team collaboration software, allowing workers to stay connected and productive from anywhere in the world and from any device. For more information, please visit https://www.mangoapps.com/.
May. 28, 2016 04:30 PM EDT Reads: 900
WebRTC is bringing significant change to the communications landscape that will bridge the worlds of web and telephony, making the Internet the new standard for communications. Cloud9 took the road less traveled and used WebRTC to create a downloadable enterprise-grade communications platform that is changing the communication dynamic in the financial sector. In his session at @ThingsExpo, Leo Papadopoulos, CTO of Cloud9, will discuss the importance of WebRTC and how it enables companies to fo...
May. 28, 2016 03:45 PM EDT Reads: 2,536
The IoT is changing the way enterprises conduct business. In his session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, discuss how businesses can gain an edge over competitors by empowering consumers to take control through IoT. We'll cite examples such as a Washington, D.C.-based sports club that leveraged IoT and the cloud to develop a comprehensive booking system. He'll also highlight how IoT can revitalize and restore outdated business models, making them profitable...
May. 28, 2016 02:00 PM EDT Reads: 2,922
In his session at 18th Cloud Expo, Bruce Swann, Senior Product Marketing Manager at Adobe, will discuss how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects). Bruce Swann has more than 15 years of experience working with digital marketing disciplines like web analytics, social med...
May. 28, 2016 02:00 PM EDT Reads: 1,364
IoT generates lots of temporal data. But how do you unlock its value? How do you coordinate the diverse moving parts that must come together when developing your IoT product? What are the key challenges addressed by Data as a Service? How does cloud computing underlie and connect the notions of Digital and DevOps What is the impact of the API economy? What is the business imperative for Cognitive Computing? Get all these questions and hundreds more like them answered at the 18th Cloud Expo...
May. 28, 2016 01:00 PM EDT Reads: 2,338
SYS-CON Events announced today the How to Create Angular 2 Clients for the Cloud Workshop, being held June 7, 2016, in conjunction with 18th Cloud Expo | @ThingsExpo, at the Javits Center in New York, NY. Angular 2 is a complete re-write of the popular framework AngularJS. Programming in Angular 2 is greatly simplified. Now it’s a component-based well-performing framework. The immersive one-day workshop led by Yakov Fain, a Java Champion and a co-founder of the IT consultancy Farata Systems and...
May. 28, 2016 11:00 AM EDT Reads: 4,051
Customer experience has become a competitive differentiator for companies, and it’s imperative that brands seamlessly connect the customer journey across all platforms. With the continued explosion of IoT, join us for a look at how to build a winning digital foundation in the connected era – today and in the future. In his session at @ThingsExpo, Chris Nguyen, Group Product Marketing Manager at Adobe, will discuss how to successfully leverage mobile, rapidly deploy content, capture real-time d...
May. 28, 2016 10:45 AM EDT Reads: 1,621
SYS-CON Events announced today that BMC Software has been named "Siver Sponsor" of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2015 at the Javits Center in New York, New York. BMC is a global leader in innovative software solutions that help businesses transform into digital enterprises for the ultimate competitive advantage. BMC Digital Enterprise Management is a set of innovative IT solutions designed to make digital business fast, seamless, and optimized from mainframe to mo...
May. 28, 2016 09:45 AM EDT Reads: 2,266
What a difference a year makes. Organizations aren’t just talking about IoT possibilities, it is now baked into their core business strategy. With IoT, billions of devices generating data from different companies on different networks around the globe need to interact. From efficiency to better customer insights to completely new business models, IoT will turn traditional business models upside down. In the new customer-centric age, the key to success is delivering critical services and apps wit...
May. 28, 2016 09:15 AM EDT Reads: 1,198
Join us at Cloud Expo | @ThingsExpo 2016 – June 7-9 at the Javits Center in New York City and November 1-3 at the Santa Clara Convention Center in Santa Clara, CA – and deliver your unique message in a way that is striking and unforgettable by taking advantage of SYS-CON's unmatched high-impact, result-driven event / media packages.
May. 28, 2016 09:00 AM EDT Reads: 2,434
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, will provide an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life ...
May. 28, 2016 08:45 AM EDT Reads: 1,982
SYS-CON Events announced today that MobiDev will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business managers to a full-scale mobile software company with over 200 develope...
May. 28, 2016 07:15 AM EDT Reads: 2,691
SoftLayer operates a global cloud infrastructure platform built for Internet scale. With a global footprint of data centers and network points of presence, SoftLayer provides infrastructure as a service to leading-edge customers ranging from Web startups to global enterprises. SoftLayer's modular architecture, full-featured API, and sophisticated automation provide unparalleled performance and control. Its flexible unified platform seamlessly spans physical and virtual devices linked via a world...
May. 28, 2016 06:00 AM EDT Reads: 2,261
Companies can harness IoT and predictive analytics to sustain business continuity; predict and manage site performance during emergencies; minimize expensive reactive maintenance; and forecast equipment and maintenance budgets and expenditures. Providing cost-effective, uninterrupted service is challenging, particularly for organizations with geographically dispersed operations.
May. 28, 2016 05:00 AM EDT Reads: 2,122
SYS-CON Events announced today TechTarget has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY, and the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. TechTarget is the Web’s leading destination for serious technology buyers researching and making enterprise technology decisions. Its extensive global networ...
May. 28, 2016 05:00 AM EDT Reads: 3,247
SYS-CON Events announced today that Commvault, a global leader in enterprise data protection and information management, has been named “Bronze Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY, and the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Commvault is a leading provider of data protection and information management...
May. 28, 2016 04:15 AM EDT Reads: 3,214