1

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.

2
  • Do you have two HTTP servers running? It sounds like the CGI script may be served as text by the rails server, and that is why it isn't appear in the Apache log. Nov 8, 2013 at 11:59
  • Yes - I believe this is/was the issue. In previous versions of Rails / OS X, this was not an issue, but now, it is a problem (perhaps due to updated sandboxing procedures)?. Nov 10, 2013 at 13:57

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.