Changes
Title
unchanged
How to install Yii 2 advanced on a shared hosting environment
Category
unchanged
How-tos
Yii version
changed
2.0
Tags
changed
advanced,yii 2 advanced, advanced, shared hosting
Content
changed
I've read many comments that it's not possible to install Yii 2 advanced on a shared hosting environment, as it has two webroots. This is partially true.
In this tutorial I'm going to demonstrate how to install Yii 2 advanced on GODADDY shared hosting. Why GODADDY? **In GODADDY it's possible to set the document root of the subdomains and addon domains
aboveout of the public_html folder.**
(In other hostings this trick might not work
. For example, in Resellerclub hosting I tried to set the document root above the **public_html** folder but I didn't succeed).
My
main website is in Yii 1, which is hosted on Godaddy shared hosting. I've also installed
a Yii 2 advanced
website on subdmain. Look:
- Main domain
(Yii 1): [http://oligalma.com](http://oligalma.com "")
-
Yii 2 frontend: [http://yii2advanced.oligalma.com](http://yii2advanced.oligalma.com "")
- Yii 2 backend: [http://admin.yii2advancSubdomain (Yii 2): [http://ed
u.oligalma.com](http://
admin.yii2advanced
u.oligalma.com "")
Take note that, in this example, I installed Yii 2 advanced
frontend on a subdomain (in order not to buy a new domain). But you can install Yii 2 advanced on a domain as well.
How to achieve this? Well, we just need to create a folder on the **/home/myself** directory called, for example, **sites**
(or whatever). Then we upload the Yii 2 advanced files on **/home/myself/sites/yii2advanced** (you can give the directory any name you want). Then, using the Godaddy cPanel, we create 2 subdomains:
- yii2advanced.
oligalmawebsite.com ---> /home/myself/sites/yii2advanced/frontend/web
- admin.yii2advanced.
oligalmawebsite.com ---> /home/myself/sites/yii2advanced/backend/web
```php
home
├── myself[...]
```
Finally, you may need to adjust thed an A record
s of your main domain.
And that's all!!
(You can create the **sites** folder if you plan to put several domains/subdomains there. If not, you can just put the yii2advanced folder directly in **/home/myself**)[...]