Sobhan Bagheri Sobhan Bagheri - 1 month ago 28
PHP Question

Redirected too many times error after Yii2 application deploy

I am trying to deploy my Yii2 application using Deployer

My server is

Ubuntu server 16.4.10 LTS
, I have configured everything right, When I simply copy the project to server using filezilla everything works fine but when I deploy it with deployer I get this error in google chrome:

Redirected too many times


I've tried configuring deployer a couple of times differently but I get the same error.

p.s: I have used deployer for my other project with this configuration type and it works without any problem.

Answer

Found the solution! Sometimes if a yii2 error occurs It shows too many redirects error instead of internal server error (500), so enable debug mode from web/index.php (uncomment these two lines):

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

and you can see exactly what causes the problem.

p.s: Redirected too many times error was because the 777 permissions for runtime and assets folder were not set.