Running the console from within the specific site app directory 
(/var/www/vhosts/mydomain.com/site1/app) looks like the right thing to do, 
however, because it's picking up a different site at run time, it would go 
looking for the include_path setting in the php.ini. It looks like the path 
for site2 could be hardcoded in that setting.  

I'm not sure that putting /usr/share/cakephp2 on the PATH is desired, 
because CakePHP 2.x installations have Console/cake under the app directory 
anyway, and would rely on the include_path to pick up the correct lib 
directory for CakePHP Core.

As a side note, in CakePHP 3, each CakePHP application is expected to have 
it's own installation of CakePHP Core installed via composer, possibly 
existing under the vendors directory. With a CakePHP 2.x installation using 
composer, the CakePHP Core, using a pear package, would exist under 
app/Vendor/pear-pear.cakephp.org, and composer would take care of setting 
up the include_path via the autoload.php in app/Vendor.  If you're starting 
out with a new multi-domain set up, I would strong recommend using composer 
with CakePHP 2.x, so you're used to it if/when you should upgrade to 
CakePHP 3.  You will also relieve yourself of the burden of having to 
upgrade all the sites at the same time, should you need to upgrade CakePHP 
versions for minor releases.

Regards
Reuben Helms

On Sunday, 19 January 2014 09:39:48 UTC+10, April DeRossett wrote:
>
> I don't know why I can't wrap my head around this. 
>
> *Situation:*
> I have multiple cake applications located as subdomains with my domain 
> being organized as follows:
>
> mydomain.com
>
>    - *site1*.mydomain.com
>       - *site2*.mydomain.com
>       - site3.mydomain.com
>       - etc...
>    
> I have installed my CakePHP Console under /usr/share/cakephp2.  I modified 
> my .bash_profile to include this path for export PATH.  When I run cake 
> from any location I get the "Welcome to CakePHP" message.
>
> I have created a HelloShell.php following the instruction on the Cake 
> website and placed it in 
> /var/www/vhosts/mydomain.com/*site1*/app/Console/Command.  
> then I run the following:
>
> # cd /site1/app
>
> # Console/cake hello
>
> and get the following:
>
>    - PHP Warning:  strtotime(): It is not safe to rely on the system's 
>    timezone settings. You are *required* to use the date.timezone setting or 
>    the date_default_timezone_set() function. In case you used any of those 
>    methods and you are still getting this warning, you most likely misspelled 
>    the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no 
> DST' 
>    instead in 
> /var/www/vhosts/mydomain.com/*site2*/lib/Cake/Cache/CacheEngine.php 
>    on line 60
>    - Error: Shell class HelloShell could not be found.
>    #0 
> /var/www/vhosts/mydomain.com/*site2*/lib/Cake/Console/ShellDispatcher.php(190):
>  
>    ShellDispatcher->_getShell('ba')
>    #1 
> /var/www/vhosts/mydomain.com/*site2*/lib/Cake/Console/ShellDispatcher.php(68):
>  
>    ShellDispatcher->dispatch()
>    #2 /var/www/vhosts/mydomain.com/*site2*/lib/Cake/Console/cake.php(51): 
>    ShellDispatcher::run(Array)
>    #3 {main}
>    
> *Question:*
>
>    1. Why is the ShellDispatcher looking in the site2 directory when I am 
>    running from the site1 app?
>    2. If I place the same HelloShell.php in the /var/www/vhosts/
>    mydomain.com/*site2*/app/Console/Command -- It runs without issue.  
>    
>
> *Goal:* My goal is to be able to run CRON jobs using shells from each of 
> the subdomains.  
>
> Any help you can give will be greatly appreciated.  
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to