CakePHP on Media Temple (dv) 3.5
Tags: CakePHP, PHP, Linux, Media Temple | Written on 18/6/08

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:
cd /var/www/vhosts/domain.com/conf/ 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:
<Directory /var/www/vhosts/domain.com/subdomains/tools/httpdocs> <IfModule sapi_apache2.c> php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir "/cake:/var/www/vhosts/domain.com/subdomains/tools/httpdocs:/tmp" </IfModule> <IfModule mod_php5.c> php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir "/cake:/var/www/vhosts/domain.com/subdomains/tools/httpdocs:/tmp" </IfModule> </Directory>
Now we need to reload the vhost to include that loads our new config file.
Bash:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com service httpd graceful
Great! Now we can have a central set of cake files and use it for each domain.
Comments
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.
As far as the subdomain, no there is no particular reason. That happened to be the domain I was configuring at the time.