CakePHP on Media Temple (dv) 3.5: CakePHP, PHP, Linux, Media Temple

CakePHP on Media Temple (dv) 3.5

Category: Linux & Server Admin Tags: CakePHP, PHP, Linux, Media Temple | Written on Jun 18, 2008

A good thing to do when deploying CakePHP websites is to load one copy of the CakePHP core files onto your server, and point all of your domains to that core directory. 

Media Temple's Plesk default configuration does not let PHP access files outside the website httpdocs. So we need to configure the domain's settings to have access to the root /cake folder, or wherever you happened to put the CakePHP root files.

First, let's make a new config file in our domain. Make sure you replace domain.com with your domain.

Bash:
  1. cd /var/www/vhosts/domain.com/conf/
  2. vi vhost.conf

Then basically we are over riding the default settings of Plesk with our own. Setting open_basedir to allow the /cake path.

Apache:
  1. <Directory /var/www/vhosts/domain.com/subdomains/tools/httpdocs>
  2.         <IfModule sapi_apache2.c>
  3.                 php_admin_flag engine on
  4.                 php_admin_flag safe_mode off
  5.                 php_admin_value open_basedir "/cake:/var/www/vhosts/domain.com/subdomains/tools/httpdocs:/tmp"
  6.         </IfModule>
  7.         <IfModule mod_php5.c>
  8.                 php_admin_flag engine on
  9.                 php_admin_flag safe_mode off
  10.                 php_admin_value open_basedir "/cake:/var/www/vhosts/domain.com/subdomains/tools/httpdocs:/tmp"
  11.         </IfModule>
  12. </Directory>

Now we need to reload the vhost to include that loads our new config file.

Bash:
  1. /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com
  2. service httpd graceful

Great! Now we can have a central set of cake files and use it for each domain.

Comments

#1. J.J. http://www.jjkaye.com on Nov 11, 2008
Marc-

Hi, thanks for all your insights, this blog is great. I'm trying to accomplish something similar, however with Symfony :)

Basically I'm just creating a symfony directory on my domain.com/ directory. In there I'm checking out a copy of my website and basically using the httpdocs folder as a symlink to my /web folder. My question is this, I noticed in the code you provided:

<Directory /var/www/vhosts/domain.com/subdomains/tools/httpdocs>

You use the subdomains directory for you apache directory settings. Is there any particular reason for this? Thanks.
#2. Marc Grabanski http://marcgrabanski.com on Nov 11, 2008
JJ - first of all, I'm glad you find the blog useful.
As far as the subdomain, no there is no particular reason. That happened to be the domain I was configuring at the time.
#3. Justin http://www.twilightpix.com on Feb 20, 2009
Great post man! Came in handy, Media Temple needs to add this to their docs.
#4. Mike on Feb 27, 2009
Hello Marc. I would love to write this for our KnowledgeBase but was wondering if you could be a bit more verbose about what would be needed next to get some kind of testapp running on cake. Thanks a lot. I will definitely give you a nice link on the article!

mike @ (mt)
#5. Website Ideas http://www.website-ideas.co.uk on Mar 24, 2009
Very interesting, Thanks :)

Leave a Comment

Other Reading - Categories