Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts

    having trouble setting up Apache with CGI on Mac

    Hello!

    Latley i have been trying to set up CGI on my Mac, so i followed these instructions: http://www.cgi101.com/book/connect/mac.html
    everything was perfect. I could see no worries about "ooh, maybe i have done that bit wrong", i was quite sure i got it right!
    so when i went to "localhost/~casparwylie/first.cgi
    it did NOT display how i wanted it to, it looked like a txt file of the code, the perl code was just displayed on the browser without it responding as an actual program, i am stumped. How do i fix this? if you have any questions, or requests to see code, etc, please ask!

    Thanks!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Did you restart apache after setting the configs for the cgi-script addhandlers? Also, you'll want to verify that it's not within a directory block in the httpd.conf; used to require a cgi-bin in order to run cgi scripts.

  • #3
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts
    i am told on the site, i need to turn web sharing on, yes i did that. ANd
    you'll want to verify that it's not within a directory block in the httpd.conf; used to require a cgi-bin in order to run cgi scripts.
    what do you mean??
    Thanks!

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    If its within a <Directory> block, it should only apply for children of that directory.

    Which reminds me though, did you make sure you added the ExecCGI option to a valid directory block?

    Yeah, the sharing will need to be on since you are retrieving from the ~ of the user's specified, so you need to have the proper permissions set for the apache user to read and possibly write to those directories. I assume that the mac sharing simply adds the group to the permissions in order to do so (I haven't a clue how the mac works).

  • #5
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts
    interesting, yes my <Directory> has the ExecCGI stuff, i did that!
    I am not sure if you know what i mean by "xampp" but i have that for privious stuff (PHP, SQL), and when i had that running and the web sharing on, the file said "Access forbidden!", so yes, when i have apache running through Xampp, that happens, when i only have WEb sharing on, it just displays the perl files code as if it was a txt file showing on a browser, oh another thing, this might be pointless and irrelevant, but the icon on the cgi file displays as a Ruby file??! anyway, thats just a thing that might help..

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Wait. So you have both apache and xampp running? You can't do that; both of these by default will require port 80, and whichever one gets it first is the one that wins.

  • #7
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yes, but i use xampp to run Apache, any way, neither work, so when i try web sharing it shows the perl code as raw text, and when i use xampp to run apache, it says "Access forbidden!"

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You cannot run 2 pieces of software that listen on the same port at the same time. If you do, the first one that gets the port will win, which means that the configurations associated with that software are what is used. So you are likely seeing an in-configured version of the apache running the perl scripts which is not set to parse them.
    There is no reason to install multiple versions though. xampp is simply a bundle of software, and it does include apache. If you are trying to manually configure a second install of apache, this needs to be run on a different port if you intend to use them both at the same time. I don't know why you would do that though, you can just configure apache or xampp's apache to deal with the perl code as well.

  • #9
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok, so what do i need to do?

  • #10
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    If it was me, I'd remove xampp. But that said I've never used lamp/wamp/xampp before either, I've always configured each component separately.
    Or you can configure it to listen on a different port in httpd.conf than port 80. Only difference is you'll need to either establish port forwarding or simply add the port to your address (http://127.0.0.1:8088/yourpaths) for example.
    Both are feasible, but I would say multiple versions of apache will just result in multiple pieces of software to keep track of and update. That's why I'd just use the one.

  • #11
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    If it was me, I'd remove xampp. But that said I've never used lamp/wamp/xampp before either, I've always configured each component separately.
    Or you can configure it to listen on a different port in httpd.conf than port 80. Only difference is you'll need to either establish port forwarding or simply add the port to your address (http://127.0.0.1:8088/yourpaths) for example.
    Both are feasible, but I would say multiple versions of apache will just result in multiple pieces of software to keep track of and update. That's why I'd just use the one.
    When you say multiple versions, thats web sharing and Xampp, right?
    would this really matter even if i turn one off and the over on, like i have been doing?

  • #12
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I mean multiple versions of the same software. If web sharing uses apache, then yeah its conflicting with xampp.
    But its not just the same apps that can conflict. You cannot run multiple pieces of software listening on the same port.

  • #13
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok, so what should i do?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •