Welcome Guest | Login

Integration of PHP and a Rails app

My rails app is up and running in a Mongrel cluster going through Apache. I also want a PHP forum to run in a subdirectory of my domain.

I've installed PHP per http://ca3.php.net/manual/en/install.unix.apache2.php

root@bender [~/apache/conf]# ~/apache/bin/apachectl -M
[Thu Sep 04 02:47:08 2008] [warn] module proxy_module is already loaded, skipping
Loaded Modules:
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
log_config_module (static)
env_module (static)
mime_magic_module (static)
usertrack_module (static)
setenvif_module (static)
ssl_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
dav_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
info_module (static)
cgi_module (static)
dav_fs_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
rewrite_module (static)
so_module (static)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_http_module (shared)
php5_module (shared)
Syntax OK
I've added this to httpd.conf as described in that document.
<FilesMatch \.php$>
 SetHandler application/x-httpd-php
</FilesMatch>
I've also tried:
AddType application/x-httpd-php php
and adding it to mime.types.

When I access a test file at forum/hello.php, it prompts me to download it rather executing it.

I also tried adding this rule which I had on my shared hosting:
RewriteCond %{REQUEST_URI} ^/forum.*
RewriteRule .* - [L]
With this rule, the file returns 403.

2008-09-03 09:52 PM

I could see that your app is under the /root directory. It would be better if you create a user and put your app under the user's home directory. Also change the DocumentRoot in the apache vhost entry and put the following rewrite rule.

-------------
RewriteCond %{REQUEST_URI} ^/forum.*
RewriteRule .* - [L]

Then you'll be able to access your php pages without any issues.

2008-09-04 06:09 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.