I'm trying to install a CakePHP app on a subdomain in my server. I want to make an advanced installation and separate the core and app libs from the webroot directory.
I put the entire project in a folder on home directory and move the content of webroot directory to subdomain's httpdocs directory.
Then, it looks like:
subdomains-httpdocs:
drwxrwxrwx 2 root root 4096 Mar 21 08:34 css
-rwxrwxrwx 1 root root 2760 Mar 21 08:34 css.php
-rwxrwxrwx 1 root root 374 Mar 21 08:34 favicon.ico
drwxrwxrwx 2 root root 4096 Mar 21 08:34 files
drwxrwxrwx 2 root root 4096 Mar 21 08:34 img
-rwxrwxrwx 1 root root 2731 Mar 21 08:43 index.php
drwxrwxrwx 2 root root 4096 Mar 21 08:34 js
-rwxrwxrwx 1 root root 3086 Mar 21 08:34 test.php
I edited the index.php file and change ROOT and APPDIR constants to point cake holder and app folders (at home directory), respectively. Finally, I modified the .htaccess files (3 files) adding RewriteBase parameter pointing to app directory (as cook book says http://book.cakephp.org/view/917/Apache-and-mod_rewrite-and-htaccess).
I checked that mod_rewrite is loaded in apache and AllowOverride All is active, but it doesn't work. It responses HTTP 500 everytime.
If I put the entire project in httpdocs directory (including webroot directory), it works perfectly.
Can you help me with this?
UPDATE
I checked again and it works if all directories are in httpdocs folder (core and app directories). However, they don't work in another location.
It returns
Warning: include(cake/bootstrap.php) [function.include]: failed to open stream: No such file or directory in /var/www/vhosts/mydomain.com/subdomains/subscribers/httpdocs/apptest/webroot/index.php on line 83
Warning: include(cake/bootstrap.php) [function.include]: failed to open stream: No such file or directory in /var/www/vhosts/mydomain.com/subdomains/subscribers/httpdocs/apptest/webroot/index.php on line 83
Warning: include() [function.include]: Failed opening 'cake/bootstrap.php' for inclusion (include_path='/home/systemtest:/home/systemtest/app/:.:') in /var/www/vhosts/mydomain.com/subdomains/subscribers/httpdocs/apptest/webroot/index.php on line 83
Thanks in advance
I found a solution:
After trying different things, I figured out that the problem was with webserver permissions. When the app and cake folder was in httpdocs directory, the application worked perfectly but after moving them to another directory, index.php was returning a HTTP 500 indicating that failed opening files in cake core directory.
The solution was to add a VirtualHost in httpd.include file of the subdomain:
<VirtualHost xx.xx.xx.xxx.xx:80>
ServerName subdomain.mydomain.com
Alias /myapp /home/myapp/app/webroot
DocumentRoot /home/myapp/app/webroot
<Directory /home/myapp/app/webroot>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
I thought that I could separate app, cake and webroot directories and manage installation with .htaccess with no apache specific virtual host.
Thanks to Amy and Leo for their help