Mobile app version of vmapp.org
Login or Join
Berumen354

: Perl script rendered in browser as code through symlink - fine when accessed directly I have a Rails 4 app that has some views that post to Perl cgi scripts. The perl scripts are accessed

@Berumen354

Posted in: #Apache #Apache2 #Htaccess #RubyOnRails

I have a Rails 4 app that has some views that post to Perl cgi scripts. The perl scripts are accessed via a symbolic link to a folder called "cgi-bin". When I navigate to a perl script through the symbolic link they are rendered as text instead of executed (ie: localhost:3000/cgi-bin/test.cgi), however when I access them directly they execute without issue (ie. localhost/path/to/cgi-bin/test.cgi).

I am using apache2 on os x. In the directory localhost/path/to/ I have an .htaccess file that contains the following:

# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI


I have the exact same lines in the .htaccess file that I have in localhost:3000/

I have also uncommented the AllowOverride all in httpd.conf.

The are no errors in apache's error log. When I access the direct link to test.cgi a new line is appended to apache's access log, when I access the script through the symbolic link (and it is rendered as text), there is no line appended to the access log.

Any idea why this error occurs? This setup worked fine in a previous version of rails of OS X, but recently I upgraded to Mavericks and figured I should update the Rails application to v4.0 as well.

Update -
I've debugged a bit more and found that the directives in the htaccess file are not being honored. When I added authentication to the htaccess file I was still able to access an html file in the directory and when I added a redirect rule, I was not redirected. It seems this is the problem I need to fix, although I'm not sure how to go about it.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Berumen354

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jessie594

I recently solved this problem by switching my Rails setup to Passenger, which uses Apache. Now both the Perl scripts and the Rails site are run through apache. This has the added value that now .htaccess files are honored, allowing me to run the perl scripts without issue.

There were a few other permission issues that I need to resolve, but everything works now. I posted in depth directions on how I solved this issue in the following 2 posts:

Getting-rails-4-and-passenger-set-up-on-mavericks

Perl-scripts-now-work-in-rails-passenger

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme