Vladimir
Vladimir

Reputation: 13

Class yii\debug\Module does not exist

I am trying to run my Yii2 application on Vagran virtual machine. As provison I use Ansible. Here is my ansible playbook file:

---
- hosts: vagrant
  sudo: true
  tasks:
- name: 1. install Apache
  apt: name=apache2 state=present

- name: 1.1 Delete temporary file
  file: path=/var/www/web/index.html state=absent

- name: 2. install PHP module for Apache
  apt: name=php5 state=latest update_cache=yes

- name: 3. Install PHP GD library
  apt: name=php5-cli state=latest

- name: 4. Start Apache
  service: name=apache2 state=running enabled=yes

- name: 5. Install MySQL
  apt: pkg=mysql-server state=present

- name: 6. Install python-mysqldb
  apt: pkg=python-mysqldb state=present

- name: 7. Install PHP MySQL bindings
  apt: pkg=php5-mysql state=present

- name: 8. Restart apache
  service: name=apache2 state=restarted

- name: 9. Set MySQL root password
  debconf: name='mysql-server' question='mysql-server/root_password' value='password' vtype='password'

- name: 10. Confirm MySQL root password before installing
  debconf: name='mysql-server' question='mysql-server/root_password_again' value='password' vtype='password'

- name: 11. Database creation with name gitSearch 
  mysql_db: name=gitSearch state=present

- name: 12.a Copy database dump
  copy: src=../gitSearch.sql.bz2 dest=/tmp/gitSearch.sql.bz2 

- name: 12.b Copy database dump
  mysql_db: name=gitSearch state=import target=/tmp/gitSearch.sql.bz2

- name: 13. Ensure curl is installed
  apt: pkg=curl state=installed
  when: ansible_os_family == 'Debian'

- name: 14. Install Composer into the current directory
  shell: >
    curl -sS https://getcomposer.org/installer | php
    creates=/usr/local/bin/composer

- name: 15. Install php5-curl
  apt: name=php5-curl state=latest update_cache=yes

- name: 16. Move Composer into globally-accessible location.
  shell: >
    mv composer.phar /usr/local/bin/composer
    creates=/usr/local/bin/composer

- name: 18. Update dependencies v2
  composer: command=install working_dir=/var/www

When I run my project I have an exception:

ReflectionException

Class yii\debug\Module does not exist
in /var/www/vendor/yiisoft/yii2/di/Container.php

I think the problem is with composer, because before provision gets to composer tasks everything is fine. On my local machine (not Vagrant box) everything was fine too. Debugger section in config:

$config['modules']['debug']['class'] = 'yii\debug\Module';
$config['modules']['debug']['allowedIPs'] = ['*']; 

Upvotes: 1

Views: 14263

Answers (1)

XzAeRo
XzAeRo

Reputation: 566

Looks like the Debug module and/or the Gii modules aren't installed.

Please check the composer.json file in the root of your yii2 project, and make sure that the following lines are present in the require-dev section of the composer file: "yiisoft/yii2-debug": "~2.0" and "yiisoft/yii2-gii": "~2.0".

Then run composer update in the root of your project.

If that is not the problem, you're probably running the application with the wrong permissions.

Happy coding!

Upvotes: 7

Related Questions