Web programming has a very important place nowadays. And within the web technologies, the PHP language is one of the most popular. That’s why several frameworks bring together the development process. Today, I’ll show you how to install Yii PHP framework on Ubuntu 20.04
In order to be pragmatic and flexible, Yii PHP was born. It is a framework for object-oriented PHP development that uses the architectural pattern MVC. What makes it ideal for developing many web applications such as forums, information sites or virtual shopping.
With Yii PHP you will have no licensing problems because it is open source (BSD Licence) which makes it ideal for community, educational or long-range projects.
Yii is not so different from frameworks like Laravel or CakePHP but it provides another way of doing things. Let’s say similar but not the same.
So, let us start.
Install Yii PHP Framework on Ubuntu 20.04
As it is a PHP framework, it is required that you have PHP installed on your computer. It also installs some PHP modules, as well as the unzip package.
:~$ sudo apt install php php-pdo php-intl php-xml php-zip php-mbstring phpunit php-mysql php-sqlite3 unzip
1.- Install Composer on Ubuntu 20.04
The installation method recommended by the Yii development team is to use composite.
As we have explained, Composer is a PHP dependency manager that can be installed on Linux, very easily.
Also, you can get more information about Composer with this post:
When Composer is installed and well configured, we can start the installation.
2.- Installing Yii PHP framework on Ubuntu 20.04
With Composer already installed, you can start the installation of Yii with the following command:
:~$ composer create-project --prefer-dist yiisoft/yii2-app-basic project
You have to replace project with the name of your desired project.
Then the installation will start and when it is finished, you will see this screen.
And in the end, add the following:
So, save the changes and close the file.
The next step is to serve the project, to prove that all is well. If you did the installation on a local computer, execute this command:
:~$ php yii serve Server started on http://localhost:8080/ Document root is "/home/angelo/project/web" Quit the server with CTRL-C or COMMAND-C. [Mon May 18 22:39:44 2020] PHP 7.4.3 Development Server (http://localhost:8080) started
And this will make the project available from
You can also specify a host and a port:
:~$ php yii serve 192.168.250.20 --port=1234
Finally, open your favorite web browser and go to
http://host:port and you will see the following:
So, Yii is ready to start developing web applications.
Yii is a less popular framework than CakePHP or Laravel, but equally powerful. Many websites are made with this framework and the results are fantastic for the developer and the end-user.
On the other hand, the installation of Yii is facilitated thanks to its compatibility with Composer.
So, share this post, join our Telegram Channel and buy us a coffee 🙂