Need some clarification about Yii Framework

Hi, everyone :)

First of all, I know there already are topics on using Yii Framework on shared hosting. I read those topics but I am not really convinced that I got my answer.

I read on some topics (Not sure if it was here or on Stackoverflow) that there is no way we can use Yii 2.0 Advanced application on a shared hosting environment.

Is it true? If it’s not, what settings do I need? And how do I access contents of /web folders without having /web in the address itself?

I found this :

But no matter what I did, I just couldn’t get it to work …

What i am trying to do is creating an app for a number of end users. and these users need to be able to run the app in a shared hosting environment, just like what they might do with a script like WordPress or Joomla and etc …

I will be very thankful if you provide some directions.

What’s the specific problem?

You can either do some .htaccess black magic or just put the content of the web-folder into your domain root.

Thanks for your reply.

Well, I installed it via archive file.

Tried to do what it says in "GETTING STARTED". first of all, there is no main-local.php in common/config to set the db connection in. am i suppose to create it myself?

The instruction says Apply migrations with console command yii migrate, how is a user suppose to do so in a shared hosting environment?

and at last, when i navigate to the main URL of the path on my localhost where i have installed this on, I just see a list of directories, and the site itself doesn’t actually load.

I thought of this myself but one problem that comes to mind is when doing so, you need to place everything other than web-folder above the public_html. Now, what if the user has 2 domains on their website? For example in cPanel, if the user has an addon domain on which they want to install Yii 2.0 advanced, since the folder for that domain usually (by default) resides inside the public_html, then for that addon domain, a folder above the publicly accessible folder would be inside public_html!

Something like this :

Public_html

–>addondomain.com

–>-->web-folders

–>Yii Advanced Main Files

I think i have to work something out using htaccess but i am not very good at this. I appreciate some insights.

Is this one suitable :

Anyone … ?

Shared hosting can be a lot of things…

What you need for Yii, however, is a shared hosting environment that provides shell access.

And where you can run Composer, etc.

And the ability to choose a web root in cpanel/whatever.

All decent shared hosts should be able to accommodate that.

Thanks for your reply.

But when we intend to make a script available to public (like Joomla and WP) we have to consider that the average user doesn’t have such access and if they do, they don’t know how to use it.

What i need is an approach that makes this app usable for public which should not involve using shell and/or changing web root.

Forget about the advanced template (and the derivatives) - choose the basic one. It is a good starting point for 99 % of all Yii projects (including advanced projects).

If the user has several domains, simply install several basic apps, one for each domain/subdomain.

I guess you can write a script to clone and run Composer so that people don’t have to ssh into the host.

Thanks :)

The script should take care of that installation process - Composer, etc. - and I guess the basic app can be modified.

Try the practical-app-b : http://demos.krajee.com/app-practical-b

So that the web root is not funky.

Keep in mind that it is not secure, so if the script can use the standard template (with web as root) it would be better.

Good luck :)

You don’t actually have to run Composer on the server at all so no shell access is required. You can run it locally and then upload results to the server.