Use PHP in Rails project

Many times you need to use PHP scripts in Rails project. You will got so much open source PHP scripts for various use.

Example is So many Rails site is using WordPress for blogging system.

Main reason behind using PHP files or script is SEO. PHP is a very SEO friendly.

Customer does not want to spend money or time already existing scripts or program.

If you want to use PHP files or project under Rails project. Just create any folder in Public directory and put your php files in to that folder.

lets say you created the “fourm” dir in public directory.

You need to add following lines in your apache rule file(httpd.conf)

LoadModule proxy_module modules/

LoadModule proxy_http_module modules/

Under <VirtualHost  *:80> tag add following lines:

ProxyRequests Off

RewriteEngine On

RewriteCond  %{HTTP_HOST}    ^ [NC]
RewriteCond %{REQUEST_URI}  !^/forum(.*)$ [NC]

RewriteCond  %{HTTP_HOST}    ^ [NC]

RewriteRule ^/forum/?(.*)$ /document_root/forum/$1 [QSA,NC,L]

Than you are able to use PHP code or scripts in Rails project

Add a Comment

Your email address will not be published. Required fields are marked *