Posted on

by

in

Host yii2 framework project using cPanel

Host yii2 framework project using cPanel

Yii2 Hosting refers to web hosting that configured to support hosting of Yii2 framework software. The Yii2 framework is a PHP framework that used to develop web applications. Yii2 hosting using cPanel is easy just to follow steps mentioned below:

1. Upload yii2 framework project on cPanel :

First, you have to create a zip file of the yii2 project and then upload and extract it on cPanel. To upload zip file on cPanel, login into to the cPanle and go to the File manager. In the File Manager, click on public_html and then click on Upload to upload a zip file. public_html(runs project using hostname on a browser) is a default directory to run the project using cPanel. After completion of upload of a zip file and extract it as shown in below snapshot:

yii hosting

2. Move files located in web directory:

The web root directory of a yii2 project named as a web. Web root directories such as www, htdocs, and public_html of web server. We have to move all files located into the web directory to the public_html as shown in below snapshot:

yii2 framework

4. Add .htaccess file:

If a web server is apache server then add an extra .htaccess file into the web directory or public_html where the index.php file is located. The .htaccess file includes the following content as shown in below snapshot:

yii2 framework

5. index.php file :

Edit index.php file which was located into the web directory and we have moved it into public_html. If it does not move then move it into public_html as shown in below snapshot:

yii2 framework

 6. Database connectivity:

Create a database and import your database file in that database

To understand the process of creation of the database, refer to our previous blog which includes details information about database creation.

https://mediastroke.com/blog/deploy-dynamic-java-project-on-java-hosting/

project_folder/config/db.php

When you have done creation and import of database, edit db.php file located in config folder inside your project which contains database connectivity. When you open db.php to be edit write database name, username, and password as shown in below snapshot:

yii framework

7. Run yii2 framework project:

After that in the end, enter your hostname in the address bar of the browser and run the project online. Below snapshot shows the execution of a basic template of yii2 framework project as shown in below snapshot:

 yii2 hosting

Steps summary:

  1. Upload yii2 framework project on cPanel
  2. Move all files located into the web directory to public_html
  3. Add .htaccess file
  4. Edit index.php file
  5. database connectivity
  6. Run yii2 framework project or yii2 hosting.

 

Leave a Reply

Your email address will not be published. Required fields are marked *