The Best Yii Hosting: Who’s The Best For Your Site? [Updated: 2019]
Compare Yii Hosting Options
What You’ll Learn
It’s little known but it powers top brands like Oakley, SalesForce, and the Associated Press. After reading this in-depth page, you’ll gain answers to the following:
- What is Yii?
- How does it compare to similar software frameworks?
You’ll learn what Yii’s top features and uses are and how to install it.
And you’ll learn what to look for in a Yii host. I’ll also share a few personal recommendations for Yii hosts to get you started in your search.
Yii Hosting refers to web hosting that is configured to support hosting of Yii software, a PHP framework used to develop web applications.
Yii web hosts often offer:
- One-click installation of Yii
- Easy access to related web development software, like your choice of PHP versions and compatible databases.
- Speed and performance needed for optimal development on the platform.
What is Yii?
Yii is an oddly named, open source PHP framework designed for rapid development of Web 2.0 applications.
Yii stands for “simple and evolutionary” in Chinese, but at the same time it’s an acronym for “yes it is.”
Yii is a relatively new framework — version 1.1 was released in August 2013, while version 2.0 is still in beta, although it is available for download.
As of January 2018, the most current version is 2.0.9, which supports PHP7.
The framework is open source and released under the terms of the Berkeley Software Distribution (BSD) license, which means it is free but there are some redistribution limitations.
About Code Frameworks
Maybe you’ve completed some beginner PHP courses. You’re moving into intermediate PHP training and will soon be considering a variety of PHP frameworks, but you’re not sure what a framework is. Here’s a quick overview.
What is a Software Framework?
PHP developer Hampton Paulk has a good, concise definition of a software framework: “A software framework is a universal, reusable platform to develop software applications, products, and solutions.”
Software frameworks, including PHP frameworks, offer important advantages to developers working on mid-sized to large projects, including:
- A way to keep code organized
- Pre-built components that speed development up
- Modular development that splits the code into sections, promoting more effective and efficient teamwork
- An easy way to make code sections fixable and re-usable
- Easy installation and configuration options
- Built-in code highlighting and correction.
The Icon Motorsports website uses Craft CMS – an application built on the Yii framework. Craft also uses Twig, Guzzle, and JQuery.
What is an MVC Framework?
MVC or “Model-View-Controller” is a type of software architecture that separates the business logic of an application from its user interactions. This pattern of division is also referred to as “separation of concerns.”
The business logic (“model”) addresses the core problem being solved by the application.
It houses the data, rules, and logic of the app. There are often multiple views offered to users (such as data displayed in a variety of formats, such as visual charts, galleries, interactive lists).
The controller receives and processes input and translates it into commands sent to the model or the view.
This separation of code into into 3 interconnected parts makes it easier to re-use (re-purpose) sections of code and speeds development up.
Comparing PHP Frameworks
Once you’ve decided that a Framework is for you, you’ll need to decide on a specific framework.
The following is a high-level comparison of Yii and two of the most popular PHP frameworks.
|Quality of Documentation||Best||Good||Good|
|Extensibility||Packages Available||Highly Modular||Highly Extensible|
What is Yii Used For?
As a generic Web programming framework, Yii can be used to develop various types of applications using PHP.
It features a component-based structure, making it scalable and suitable for the development of large-scale applications.
Yii relies on object-oriented programming (OOP).
Yii 1.1 and 2.0 are currently the most popular versions of the framework.
Why Should I Use Yii?
Here are some reasons why you might use Yii instead of working with pure PHP:
- By using Yii’s built-in functions, you can speed up the development of your web application.
- Yii takes advantage of PHP’s more advanced features and allows you to use them with ease.
- If you need to customize Yii, yet you don’t want to start from scratch, you can still gain the benefits of using a framework while tailoring Yii to meet your needs.
- Yii’s support for testing makes it easy to write and run tests.
- Yii comes with built-in security and authentication features, so you don’t have to roll your own solution.
- Yii’s performance related tools help you ensure that your website runs as optimally as possible.
Yii 1.x and 2.0 Server Requirements
The Yii framework was designed to work on Apache servers running on Windows or Linux operating systems.
However, it should work with other servers and platforms with support for PHP 5 or later versions.
Yii 1.x officially supports PHP 5.1.0 or above, while Yii 2.0, which is a complete rewrite of Yii 1.1, requires PHP 5.4.0 or above.
Some developers may need to use legacy Yii 1.1 code with modern Yii 2.0 code, which involves a bit more planning.
No Special Hosting Requirements
Since Yii is a PHP framework, it does not have any special hosting requirements.
Yii is ready to work with a default Apache web server configuration, but depending on your needs or your web application, you may need to use mod_rewrite instructions to change the configuration on virtual hosts.
You can also use Yii with Nginx. And you can use PHP with FPM (FastCGI Process Manager). The necessary documentation is on the Yii Framework website.
Yii is built on top of the PHP Data Objects (PDO) extension and can use a variety of database management systems including:
How to Install the Yii PHP Framework
You may want to start experimenting with Yii (and other PHP frameworks) on your own machine first.
Before you begin installing Yii, make sure you’ve already installed Homebrew, PHP, and Composer. This is easy to do. Jump down to the resources section at the bottom of this page to get step-by-step instructions.
The installation process is straightforward. Get the latest copy of the Yii release file and unpack the folders to /wwwroot/yii. You should end up with the following directory: /wwwroot/yii/framework.
The framework can be installed anywhere, as the /framework directory contains all framework code files and is the only directory needed when deploying applications. Multiple Yii applications can use the same installation of the framework.
Craft CMS is a little-known but fast-growning PHP app built on Yii. Craft is used by the Associated Press, Netflix, ProPublica, SalesForce and other top brands.
Also, since Yii does not have to be installed in a Web-accessible directory, only the entry script needs to be exposed to web users. This is good news from a security perspective, as it restricts access to PHP files and scripts that could be used as an attack vector.
What is the Yii DAO?
Yii provides extensive support for database programming and since Yii Data Access Objects (DAO) is built on top of PDO, it enables access to different database management systems.
Applications developed using the Yii DAO can easily be switched to a different database management system without having to modify the code. This makes Yii more flexible than many other frameworks in a wide range of situations.
Using Yii: OOP Skills Required
As far as the skill-set is concerned, developers with experience in object-oriented programming (OOP) should have an easier time getting to grips with Yii, as it is a pure OOP framework.
What are the Main Features of Yii?
Some of the major features and advantages of using Yii include:
Model-View-Controller (MVC) Design Pattern
Yii adopts MVC architecture, described above, which allows for the separation of concerns.
Essentially, you can separate your business logic from user interface-related considerations.
Yii comes integrated with jQuery, so you have access to AJAX-enabled widgets, such as auto-completed input fields, tree views, data grids, and so on. You can write your user interface with as little hassle as possible.
Role-Based Access Manager is a Yii module that implements and let you use role-based access control.
This is a simple centralized access control system.
Essentially, you create roles, which are a collection of permissions. Each role or permission can be assigned a rule, which is executed to check the authorization of a particular user.
This role-based access system means that you can make high-level changes using roles instead of manually managing permissions for users individually.
Yii supports the writing and running of unit tests with ease.
Other (more minor) features include:
- Form input and validation
- Easy skinning and theming
- Support for web services
- Internationalization and localization
- Error handling and logging
- Automatic code generation
- Easy integration with third-party code
What Hosting Services are Available for Yii?
Although Yii is a relatively new framework, many hosts are offering packages designed for Yii users.
Since Yii does not have many exotic requirements and can run on a wide variety of platforms and databases, these plans usually don’t differ from hosting plans marketed for other PHP frameworks.
Many Web Hosts Offer these Yii Options:
- Free Yii installation
- Timely framework upgrades
- Ability to extend Yii framework functionality with additional compatible modules via one-click apps
Hosting Upgrades for Yii
Due to Yii’s advanced caching abilities, which make it suited for the development of big Web 2.0 sites, many hosts are keen to offer additional RAM or SSD (Solid State Drive) upgrades, thus making the most of Yii’s caching prowess and boosting performance in the process.
Since Yii is a good choice for large-scale Web 2.0 projects, many hosts offer scalable and dedicated Yii hosting.
Dedicated Hosting and VPS
- Daily backups
- Premium support
- And other perks.
These packages usually come at a fraction of the cost of a dedicated Yii server, yet they tend to offer good value for money and plenty of scalability.
My Top Choices for Yii Hosting
So what are my top recommendations and why? Read on to find out. Each hosting provider has it’s own strengths which make them worth considering.
A2 Hosting for Yii: Developer-Friendly
A2 Hosting is a developer-friendly hosting company that prides itself on offering solutions for every need.
This, in conjunction with its low prices and solid customer service, makes A2 Hosting my choice for anyone looking for inexpensive hosting options for niche hosting needs.
A2 Hosting for Yii.
HostGator for Yii: A Budget Option
If you want a simple, inexpensive web hosting solution, but you find A2 Hosting a bit difficult to use, I recommend checking out HostGator.
The company offers a wide range of full-featured plans that are all backed by top-notch customer service.
Hostgator for Yii.
Rackspace for Yii: Leading Cloud Provider Plus Managed Service
Rackspace is a leading provider of cloud-based hosting. If you’re looking for a more premium solution for your Yii web app, Rackspace might be a good fit for you.
Furthermore, Rackspace’s options are all managed, so you can offload the server system administration tasks to someone else.
Rackspace for Yii.
What are the Pros and Cons of Yii?
The Pros of Yii
- Free to use
- Can make it faster to develop solid PHP websites and apps
- Robust documentation available
Cons of Yii
- Adding a framework increases the “bloat” associated with your website
- Open source frameworks mean that you can get assistance only if others choose to help out
Yii Resources and Recommended Reading
Read about Trygve Reenskaug’s work on MVC:
Norwegian programmer Trygve Reenskaug created the MVC model back in the 1970s. Trace the fascinating development of it, and gain insight into the context in which it was generated.
- The Model-View-Controller (MVC): Its Past and Present.
- See this brief description of MVC.
- Read the history: MVC XEROX PARC 1978-79.
- Browse Reenskaug’s personal page at the University of Oslo School of Informatics.
Get your computer ready to run Yii (and other PHP frameworks)
- Install Homebrew
- Install Composer
- Confirm the composer.phar file
- Copy the composer file to usr/local/bin
- Install FXP plugin
- Install PHP
- Install the international extension for PHP
- Change the timezone in your php.ini file
Homebrew is a time-saving package manager for Macs. It gives you am easy way to install or update packages on your Mac.
Just copy this code and run it at the command line:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Composer is a dependency manager for PHP that’s going to save you a lot of time.
Go to the Composer homepage and click the “download” button. Then copy the code lines you see and run them in your CLI. Here’s the code:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') else echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
Confirm the composer.phar file
Now you want to look in your directory (type “ls” in the CLI). You should see a file called composer.phar.
Copy the composer file to usr/local/bin
In the command line, run:
sudo cd composer.phar /usr/local/bin/composer
By copying the initial composer file to the usr/local/bin, you can now run composer at the command line.
Test your installation of Composer
To test it run this in the CLI:
You should see the version of Composer displayed, followed by some sample commands.
Pro Tip: Update Composer before starting new PHP framework projects
This is a good habit and prevents conflicts between package versions.
Simply run this in the CLI:
Install FXP plugin
Next, we’re going to install the FXP Composer asset plugin, which is an NPM/Bower dependency manager for Composer.
Simply run this in your CLI:
composer global require fxp/composer-asset-plugin
First, check with the PHP framework you’re using to make sure you download a compatible version of PHP. The most recent version of PHP is 7.2.0.
Yii 2.0 is fully compatible with PHP 7.x. so in this example we’ll download PHP 7.2.0.
Simply run this in your CLI:
brew install homebrew/php/php72
To check which version of PHP you’re running simply run this in the command line:
Install the international plugin for PHP
Run this in your CLI:
brew install homebrew/php/php72-intl
Change the timezone in your php.ini file
This is required by the Symfony PHP framework. If you’re only going to test-drive Yii, and not Symfony, you can skip this step.
“Where’s my php.ini file?” Good question. Run this in your command line to find out where your php.ini file is located:
Then copy and paste that url into your browser. It’ll take you to the location, where you can open the php.ini file with a text editor.
Now search the php.ini file for “timezone.” (See yellow highlight below.)
- Uncomment the line with no timezone listed.
- Then either (a) copy and paste the url in the line above it to find your timezone, or (b) click here to find it.
In the example below, I had already copied my timezone so I could quickly paste it in.
XAMMP includes PHP and comes with a lot of useful extensions for it.
Download and install XAMMP. Follow the prompts.
Make PHP available to your command line
Go to Control Panel > Systems and Security > System > change settings.
This takes you to the System Properties window.
- Click the “Advanced” tab on the System Properties window.
- At the bottom of the Advanced tab, click “Environment Variables.”
- Look for and select the “Path” variable. (The Path variable indicates all of the applications that will be available on the command line.)
- Edit the Path: add your PHP directory to the end of the Path variable line, by typing in C:xamppphp Then click “okay.”
Test the PHP installation
Go to the command line. Type:
If PHP is installed, the version you have will display.
Go to this Composer link. Download and run Composer-Setup.exe.
Test Composer installation
Go to the command line and type:
If Composer is installed, the version you have will display.
Pro Tip: before creating any new projects in PHP frameworks, get in the habit of updating Composer via the command line by typing:
Install FXP plugin
In the command line type:
composer global require fxp/composer-asset-plugin
Composer uses Git so we want to make sure it’s installed.
Go to Git and click on “Windows build.” Download and install it.
Confirm installation of Git
In the command line, type:
If Git is installed, the version will display.
Install the international extension for PHP
This is necessary if you want to use Yii or CakePHP.
First, find the location of your php.ini file by typing this in the command line:
- Then open the php.ini file.
- Do a search inside it for “intl”.
- Uncomment the intl extension, by removing the semi-colon before it. (This makes the extension available.)
- Then save the php.ini file.
Set the timezone of the php.ini file
This is necessary if you want to test-drive Symfony. If you don’t, just skip this step.
- Do a search of the php.ini file for “timezone.”
- Uncomment the timezone line by removing the semi-colon.
- Find your timezone.
- Add it.
Other features in Languages and Frameworks For Programming
- ASP.NET Windows Developer? Here Are the Best ASP.NET Hosting Plans in 2018
- The Best .NET Framework Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best VB.NET Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best Grails Hosting: Who’s The Best For Your Site? [Updated: 2019]
Laravel Hosting: Which Is The Best Company For Your Site? [Updated: 2019]
- The Best Phalcon Hosting: Who’s The Best For Your Site? [Updated: 2019]
- PHP Hosting: Which Is Right For Your Site?
- The Best Ruby on Rails Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best Perl Hosting: Who’s The Best For Your Site? [Updated: 2019]
The Best Django Hosting: Who’s The Best For Your Site? [Updated: 2019] Python Hosting: Which Host Is Best For You?
- Server Side Includes (SSI) Hosting: Who’s The Best For Your Site [Updated: 2019]
- Java Hosting: Which Company Is Best To Host Your Java Applets?
- The Best ColdFusion Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best ASP Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best WAP/WML Hosting: Who’s Right For Your Site? [Updated: 2019]
- The Best CodeIgniter Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best CakePHP Hosting: Who’s The Best For Your Site? [Updated: 2019]
Which Node.js Hosting Provider is Right For You?
- The Best Symfony Hosting: Who’s The Best For Your Site? [Updated: 2019]
- The Best PHP 5 Hosting: Who’s The Best For Your Site? [Updated: 2019]
- PHP 4 Hosting: Do Hosts Still Offer It? [Updated: 2019]
- The Best PHP 7 Hosting: Who’s The Best For Your Site? [Updated: 2019]