vova07 / yii2-start

Yii2-Start application
Other
274 stars 115 forks source link

500 Internal Server Error & missing folders #123

Open SteppeWest opened 9 years ago

SteppeWest commented 9 years ago

After setting up my yii2-start application I get a "500 Internal Server Error" on both front end & back end. Looking through the folder structure I find that as compared to the standard yii2-advanced application the following folders are missing...

So it appears that I have an application with no models, controlers, or views.

All my other yii2 applications work as expected.

vova07 commented 9 years ago

In yii2-start this folders are missing because all needed class for work, are in separate modules, in vendor path. Can you give a screen or a log of 500 error?

SteppeWest commented 9 years ago

Here's a sample of the log...

[Sun Jan 25 01:20:47.246839 2015] [core:alert] [pid 397] [client 127.0.0.1:51213]
/WWW/yii.y2start/.htaccess: <IfModule not allowed here, referer: http://portal.dev/web/
[Sun Jan 25 01:24:59.569564 2015] [core:alert] [pid 45225] [client 127.0.0.1:51219]
/WWW/yii.y2start/.htaccess: <IfModule not allowed here, referer: http://portal.dev/web/
[Sun Jan 25 01:25:04.397372 2015] [core:alert] [pid 397] [client 127.0.0.1:51224]
/WWW/yii.y2start/.htaccess: <IfModule not allowed here, referer: http://portal.dev/web/
[Sun Jan 25 01:25:27.697763 2015] [core:alert] [pid 45225] [client 127.0.0.1:51226]
/WWW/yii.y2start/.htaccess: <IfModule not allowed here, referer: http://portal.dev/web/

Disabling the .htaccess referenced there resolved the problem but I wonder what problems I may have introduced.

Having done that the front end loads as expected but the back end is completely unstyled. Looking into the rendered code I find that assets are referenced as being at /backend/assets rather than just /assets. As a temporary workaround I created a folder matching that & copied the assets to it. The back end now renders correctly but that workaround isn't viable in the long run.

I must offer the opinion that having controllers, modules, & views in the standard locations is better because it makes tracking issues like these, and also further customisation, much easier. I also think it better to copy assets to web/assets rather than symlinking them because many shared hosting services don't permit symlinks.

vova07 commented 9 years ago

It's seems that you need to configure your apache, to enable configuration from the .htaccess file. So ensure that you have the option AllowOverride All in your directory section.

From README:

<VirtualHost *:80>
    ServerName www.yii2-start.domain # You need to change it to your own domain  
    ServerAlias yii2-start.domain # You need to change it to your own domain  
    DocumentRoot /my/path/to/yii2-start # You need to change it to your own path  
    <Directory /my/path/to/yii2-start> # You need to change it to your own path  
        AllowOverride All  # I was mean exactly this line
    </Directory>  
</VirtualHost>

What about controllers, modules, and views in the standard locations: In my application you don't have restriction, and you are free to use whatever internal structure you want. The main reason of separate modules, is to give you a really clean template, that will have just really needed things with minimal addons. So after installation each of us, can choose his preferable way to develop his application, without needed to clean up some extra directory.

About symlink: In case when it's not supported you can really easy disabled it by config file, just making linkAssets => false.

rajesh188 commented 9 years ago

dear vova07, do i have to create virtual host? please iam having trouble getting this started

i am on windows 8 with wamp server i did all mentioned in readme. i did not configure virtual hosts. im having 403 forbidden errors when accessing localhost/yii2-start pls guide me through installation.

vova07 commented 9 years ago

Hi @rajesh188 , I'm not sure about wamp but i guess you'll need to create a VH, or at least to allow override his config from .htaccess. I think you get 403 error right because you don't have AllowOverride All in your wamp config. If you have a problems with VH please take a look on this tutorial or just google something else for wamp virtual host configuration. Let me know if you'll have other questions.