Yii Framework Forum: yiic webapp demo command not creating demo in right place. - Yii Framework Forum

Jump to content

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

yiic webapp demo command not creating demo in right place.

#1 User is offline   GarryFre 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 31-March 10

Posted 13 October 2010 - 09:02 PM

On page 20, the instructions say to do CD WebRoot where WebRoot is my document root for my server. I did so. The next line says to execute the command YiiRoot/framework/yiic webapp demo and says this will create a demo program at WebRoot/demo or directly under whatever directory I am currently in.

In my case WebRoot is my public_html folder, and the YiiRoot directory is as so .... public_html/YiiRoot.

When I cd to public_html and issue the command YiiRoot/framework/yiic webapp demo the command creates the demo directory at public_html/YiiRoot/framework/demo instead of at public_html/demo. The book publisher has not been able to replicate the problem. The current idea is that there is something peculiar with my web host provider which is hostmonster.com.

I am able to create the demo directory in the proper place if I provide the path explicitely ie: YiiRoot/framework/yiic ../../demo. I also have the same issue with certain yiic shell commands to create code. I have to provide the path, which really raises the likelihood of error tremendously.

I am asked to post here and provide whatever details I have about my web host.

If you go to http://migrainesoft.com/test/index.php you you can see my current configuration.
0

#2 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 14 October 2010 - 09:06 AM

Is it possible that the directory from which you are executing the command (i.e. public_html in your case) is a symbolic link to somewhere else? The realpath() PHP command used to determine the path will expand all sym links.

FWIW, Here is the basic code that is used in the WebAppCommand to determine the directory to create the new application (taken from Yii 1.1.3, which I believe is the version you are using. SIDE NOTE: The book specifically uses Yii 1.1.2, so if continuing with the examples using 1.1.3, you may run into subtle differences in method signatures, format of generated code, etc. But all of the concepts translate fine). This might help you further troubleshoot. I don't think this is the issue, but I did notice that prior to PHP release 5.3.0, realpath() would not fail on *BSD systems if only the last last path component did not exist.

if(!isset($args[0]))
			$this->usageError('the Web application location is not specified.');
		$path=strtr($args[0],'/\\',DIRECTORY_SEPARATOR);
		if(strpos($path,DIRECTORY_SEPARATOR)===false)
			$path='.'.DIRECTORY_SEPARATOR.$path;
		$dir=rtrim(realpath(dirname($path)),'\\/');
		if($dir===false || !is_dir($dir))
			$this->usageError("The directory '$path' is not valid. Please make sure the parent directory exists.");
		if(basename($path)==='.')
			$this->_rootPath=$path=$dir;
		else
			$this->_rootPath=$path=$dir.DIRECTORY_SEPARATOR.basename($path);
		echo "Create a Web application under '$path'? [Yes|No] ";


It may be that, due to server configuration, permissions, etc., you need to fully qualify the directory location for where you want the application created. This works as expected for you, correct?

Also, can you be more specific on the subsequent issues you are encountering (and also concerned about) with regard to executing other commands in the interactive shell? I am curious from where you are running the yiic shell command to start the interactive shell.
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