How Should I Deploy A Yii 2.0 On The Server?

Hi all,

I am in a big trouble.

In my laptop the Yii 2.0 webapp is working fine. But on the server something goes wrong.

I copied the files to the server.

I commented out the DEBUG lines from the index.php.

I added 777 permissions to the asset, runtime, and the web folders.

But the CSS is still the basic, on my webpage… It does not load the CSS!

Then I copied the asset folder to the server, but still nothing.

I think the Yii 2.0 should recreate asset files, but it does not do. This is my only problem. It does not load the CSS which I created, or I don’t know.

I use the site.css but it is empty!

I have no more idea. Anybody?


Idea is to check in these order… configurations at OS level, then PHP and Yii configurations first.


[*]Check folder permissions. Are you using symlinks in asset management? Check if your hosting provider supports it?

[*]Check settings/url rewrites in the .htaccess file.

[*]Have you enabled caching by any chance? Clear up the assets and runtime folders and retry.


If nothing works start with basic tests. For example for debugging… try first with a static html and css and then test the PHP specific pages.

I think it is okay, on the /assets, /runtime, and /web there is a 777 permission.

1: Where can I find this symlinks? I use only the Yii-basic app.

2: I deleted the contain of the /asset and /runtime, nothing now. Only the file cache is enabled (it is from the Yii-basci app skeleton)

3: Okay, I try…

  1. Check this