Yii2 on shared hosting enviroment

I’m having some ideas for a project, it’s a CMS. I want to use Yii2 basic template, but the thing that bothers me is shared hosting. There’s a solution for that like this www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html where I need to put all my files 1 level below webroot and rename folder “web” to “httpdocs, www, public_html…”. But the problem ocures when I create a subdomain and then have folder structure like this i.imgur.com/DAtJoND.png and if I want to use Yii2 on my subdomain also, my files and folders will conflict. You get what I’m trying to say?

I have the same problem as you, I don’t know how to install yii2 on shared hosting

There should be wiki article for that, the subject is major.

You can do with your project something like kartik-v did with Yii templates

Contents of frontend/web/ are moved into root, contents of backend/web/ are moved into backend/, relative paths in index*.php are replaced. The only inconsistency is ‘assets’ folder, it should be renamed and namespaces have to be fixed. It easily fits into shell/console script. Not too practical if you’re relying on yiisoft templates in your work and not too eager to mess up your folders.

Here’s how I approach the thing.

It could be done in index.php, but it is more proper to place it into config. Make a clone of prod environment for shared hosting and locate it there. If you plan to use it regularly then consider to cut it into component or extend from Request.

For basic template you won’t need backend-related parts, and frontend/web should be replaced with web. I’ve had no problems with it, but I wouldn’t bet that it won’t screw up the paths in some scenario, so acceptance testing is always a good idea.