Go to content Go to navigation Go to search

People

Businesses

Setting Up Cake on the new GS 18 October 2006

I had a Media Temple shared hosting account. You may have seen the announcements they had all over that they launched a new service today. I migrated my server over to the new Grid Server and then started to play around with it. First I set up cakePHP on a sandbox domain I have hosted with them so that I could see how hard it would be to get running.

I wanted to be able to use the same cakePHP core for all the domains and subdomains hosted on the site (single point of upgrade) so I went about figuring out what I needed to define in the /app/webroot/index.php page.

Put the cake core and the vendors folders in /domains/. Then put everything in /app into /domains/domain.com/. Delete the folder called html/ that was already in there and rename webroot to html.

Put these definitions in at the start of the /domains/domain.com/html/index.php file:


define('ROOT', '/home/*server num*/domains');
define('WEBROOT_DIR', '/home/*server num*/domains/domain.com/html');
define('APP_DIR', 'domain.com');
define('APP_PATH', '/home/*server num*/domains/domain.com/');
define('CAKE_CORE_INCLUDE_PATH', '/home/*server num*/domains/cake');
define('CORE_PATH', '/home/*server num*/domains/');

Make sure you’ve got your database.inc.php file set up as you would normally set it up then fire up your browser and go to http://domain.com. You should get cake telling you it’s got a DB config and everything is ready to go.

Sphere: Related Content

Comments

  1. Sorry about using your comments – but I’m having a blacklist problem on my new TextPattern installation similar to the one you outlined (where I got this link from) – so if it does get through, the problem may be on my end.
    Cheers.

    David    Nov 8, 10:27 PM    #
     
  2. Ok I fixed it – easy when you know where to put a simple ‘.’!

    David    Nov 8, 10:37 PM    #
     
  3. Heck yeah!

    I had trouble with this bug because I had removed the txp tags that output specifically what error was being generated and replaced it with some “nice” text about 404. So I didn’t realize I was actually getting a 403.

    Ah well….

    Walker Hamilton    Nov 9, 06:18 AM    #
     
  4. Thankx for your cake component. My question is about Grid Server. I registered about 3 weeks ago. It seems unbearably slow.
    MediaTemple Grid Server:
    http://jhenterprise.com/cake/jac/index.php
    compared to some other no name host provider:
    http://therentalcalendar.net/cake/jac/index.php

    I’d be curious to know your impressions of GS off line. I am hesitanting right now to add more domains or go live with Media Temple.

    Thankyou
    John (jacmgr)

    John Del Ferro    Jan 14, 08:46 PM    #
     
  5. John, I loaded up both of your sites and they felt like they were really loading in at the same speed.

    I’ve been pretty happy with the level of service and support offered by mediatemple. I migrated from their old SS (shared server) product to the new GS product and was impressed by that whole move as well.

    I know that the Joyent guys have been talking shit about mediatemple (I have a textdrive account as well, several in fact), but honestly, you should have seen the first year of textdrive service. It would nicely be called “terrible”.

    I liked my shared server at MT and I’m liking the extras in GS. I know that they are working at getting everything together and I feel like the new GS will really be the best platform for most apps and websites going forward.

    Walker Hamilton    Jan 14, 09:37 PM    #
     
  6. Hi Walker,
    first off, thanks for the great tip on running cake on (mt) – saved me a lot of time!.

    I was wondering how this setup affects running the cakePHP scripts (like ACL and BAKE).
    because you only have one directory for cake, is it possible for these scripts to be running on your different dbs?
    Ive got everything working fine, with separate test domains (im running each test app in its own subdomain) – but, when I try and run acl.php out of the cake/scripts dir i get the following error:

    Warning: main(/home/13159/domains//app/config/core.php): failed to open stream: No such file or directory in /home/13159/domains/cake/scripts/acl.php on line 94

    now that makes me wonder as to whether i need to be passing some args to the command line to tell it which path to use. Anyway, was just wondering if you had run into (and solved?) this problem already?

    thanks for your help

    will    Feb 27, 12:53 PM    #
     
  7. Arguments. Exactly!

    Usually when you start up bake or acl you need to provide the name of the application dir you are using. In this case you’ve renamed it from app to somedomain.com or sub.somedomain.com. So when you start up the scripts make sure you feed in:

    "php bake.php -app sub.somedomain.com" or "php acl.php -app somedomain.com"

    Walker Hamilton    Feb 27, 06:37 PM    #
     
  8. well that worked like a charm!

    one last question then ill stop bothering you…

    have you ever got this error when running the scripts on (mt) – bearing in mind that acl and bake were running fine until something(?) happened :

    Fatal error: Call to undefined function: mysql_connect() in /home/*##myServerNumber##*/domains/cake/libs/model/dbo/dbo_mysql.php on line 103

    this isnt a new problem after having moved my dirs around it was happening before, Ive been asking around about this but havent had any useful info yet!

    will    Feb 28, 03:31 AM    #
     
  9. I have never had that happen.

    Walker Hamilton    Feb 28, 08:25 AM    #
     
  10. Great article Walker. I am in the process myself of switching a domain over to the Server Grid on MT and have run into problem.
    I followed the instructions above and all is set up correctly. Viewing the home page is not a problem (http://s18241.gridserver.com/) but one I start to jump around with the links I am getting “Not Found – The requested URL /pages/mission was not found on this server.”
    This is the index.php file that I created:
    define(‘ROOT’, ‘/home/18241/domains’);
    define(‘WEBROOT_DIR’, ‘/home/18241/domains/cpeworld.org/html’);
    define(‘APP_DIR’, ‘cpeworld.org’);
    define(‘APP_PATH’, ‘/home/18241/domains/cpeworld.org/’);
    define(‘CAKE_CORE_INCLUDE_PATH’, ‘/home/18241/domains/cake’);
    define(‘CORE_PATH’, ‘/home/18241/domains/’)

    Any ideas what can be wrong would be really appreciated? Thanks.

    chris    May 7, 03:04 PM    #
     
  11. Hey Chris.

    I’m guessing that your htaccess file didn’t get copied over. You won’t be able to see it (because it’s got a “dot” in front of the file name) but it’s there. You’ll need to copy that over to your web root.

    Walker Hamilton    May 9, 11:56 PM    #
     
  12. Thanks for this post. I tried installing my cake app on a grid-server account following these instructions. When I went to the static “home” page where I use ‘<?php echo $this->webroot; ?>img/’ in the view to get the path to an image for some reason it appears as: /domain.com/\/home\/*server num*\/domains\/domain\.com\/html/img/

    Any idea where the weird directory separators are coming from?

    Also when you run cake on a GS account on MediaTemple are you able to get the mod_rewrite pretty urls to work? I’ve been having to do http://domain.com/index.php/projects/view instead of http://domain.com/projects/view.

    Peter    Feb 5, 08:16 PM    #
     
  13. Hey Walker,

    Thanks for posting article for MT GS.

    How would I exclude a sub-domain from referencing the CakePHP core?

    CakePHP is supported on http://xyz.com, and also on a couple sub-domains, like http://aaa.xyz.com and http://bbb.xyz.com.

    How would I exclude a domain from CakePHP on another sub-domain, like http://ccc.xyz.com?

    The reason I ask is because once I installed cake the unsupported sub-domains started returning Internal Server Errors (500).

    Best,
    Rob

    Rob    Mar 2, 02:12 PM    #
     
  14. Uhh…..Rob

    Sorry, but I have no idea. If you don’t want the subdomain to reference cake, then create an actual folder for that subdomain (not a symlink) and don’t include .htaccess or index.php files in that folder that reference cakePHP app or core.

    Walker Hamilton    Mar 21, 10:44 PM    #
     

Leave a Comment