Yii Framework Forum: Autoload Not Working On Windows Development Machine With Php Built-In Webserver? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Autoload Not Working On Windows Development Machine With Php Built-In Webserver? Rate Topic: -----

#1 User is offline   CodeButterfly 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 30-August 12

Posted 12 October 2012 - 07:24 PM

Been testing yii on my unix-based webhost which works fine. Now in the progress of setting up my local development environment. I'm using Netbeans with PHP 5.4 on Windows 7. I'm using the built-in PHP webserver. I can serve my home page fine. However I'm getting errors when trying to access my controllers that reference models classes in my common/models folder, for example:

include(Tag.php): failed to open stream: No such file or directory


I am using the project directory structure described in The directory structure of the Yii project site wiki article by Qiang

I'm thinking it might possibly have to do with the following line in my main.php:

Yii::setPathOfAlias('common','c:\path\to\webroot\common');

I've tried a relative line as well:
Yii::setPathOfAlias('common', dirname(__FILE__).'/../../common');


I'm wondering if there is some trick with file paths on windows or else if I need to enable some php extension? Or any other ideas?
0

#2 User is offline   CodeButterfly 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 30-August 12

Posted 12 October 2012 - 09:51 PM

I believe I found the issue. Because I was using the more complicated project structure I have the "common" alias defined in both:

common/config/main.php

and

frontend/config/main.php

I had changed it to be a valid path for my development machine in common/config/main.php but not in frontend/config/main.php. Adding it to frontend config solved the problem. Still new to this project structure so perhaps I don't need the call to Yii::setPathOfAlias('common'... in the frontend config at all.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users