Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: CGI on Mac OS X 10.11

by kcott (Archbishop)
on Feb 03, 2016 at 09:27 UTC ( [id://1154329]=note: print w/replies, xml ) Need Help??


in reply to CGI on Mac OS 10.11

G'day Chuma,

I'm runnng Mac OS X 10.10.3 (Yosemite). Your version, Mac OS X 10.11.x (El Capitan), has quite a few restrictions which are new: just be aware that information I've provided below may not be valid for your version. I don't believe these restrictions are related to your current issue (although I make no guarantees); however, as this is your "newest mac", it would be a good idea to acquaint yourself with them. The overall change is called "System Integrity Protection" (SIP). Here's a good article about SIP, with links to further information.

Simply running `sudo apachectl start` may not be sufficient. You may need to stop first; then start. I have the following sourced by .bash_profile:

alias bounce_apache='sudo apachectl stop 2> /dev/null; sudo apachectl +start'

I set this up some years ago (under Mac OS X 10.7.x, I think) and it's always worked well for me. Take a look at /usr/sbin/apachectl for other options.

I followed the instructions in http://editrocket.com/articles/perl_apache_mac.html and got the same results as you, i.e. just a program listing.

I then made the following changes to /etc/apache2/httpd.conf:

  • Uncommented:

    #LoadModule cgi_module libexec/apache2/mod_cgi.so
  • Changed the Options line in:

    <Directory "/Library/WebServer/CGI-Executables"> AllowOverride None Options None Require all granted </Directory>

    to

    Options +ExecCGI

After running bounce_apache, http://localhost/cgi-bin/test.pl displays: Test Page

You may require slightly different changes depending on your setup but, I think, that should get you on track.

[Aside: Please markup URLs as links (see "Shortcuts for Markup Links" if you're unfamiliar with how to do this). Also note, my title has "Mac OS X" while yours has "Mac OS" which, I believe, is rather ancient (in computer terms).]

— Ken

Replies are listed 'Best First'.
Re^2: CGI on Mac OS X 10.11
by Chuma (Scribe) on Feb 03, 2016 at 13:14 UTC
    Hm, looks like my other comment ended up anonymous. Anyway, as I said, I changed the conf file, stopped and started Apache, and it didn't work at all; the browser said it couldn't find the server. As for SIP, I heard about it a few days ago. Didn't like it, switched it off.

      Do you have an access.log and error.log in possibly /var/log/apache2/ ?

        Mostly for Chuma's benefit:

        The ErrorLog directive (in httpd.conf) specifies the pathname of the error log.

        I haven't changed the default. Here's mine (including the preceding, important comments re <VirtualHost>):

        # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a <VirtualHost +> # container, that host's errors will be logged there and not here. # ErrorLog "/private/var/log/apache2/error_log"

        The CustomLog directive specifies the pathname of the access log. It has much the same comments re <VirtualHost>. Mine's called access_log and is in the same directory as error_log.

        For poj:

        You were effectively correct with the location: /var is a symlink to /private/var.

        — Ken

      As poj has hinted, your config changes to apache config files may have an error, preventing apache from starting. The error.log should show what the problem is.

      The apache config should contain something like this:

      <Directory "/Library/WebServer/CGI-Executables"> AllowOverride None Options +ExecCGI Require all granted </Directory>

              ...The words of the Prophets are written on the Facebook wall.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1154329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found