httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Sebastián Birch <dsbirc...@hotmail.com>
Subject RE: [users@httpd] Enabling CGI on Apache 2.2 on Mac OS X 10.6.4
Date Mon, 30 Aug 2010 16:19:13 GMT

Thanks, Bob.
I've never used perl, although it sounds interesting enough to start learning it. However,
on this occasion, I need to port an existing application written in C++ that connects to other
applications on different servers using TCP/IP sockets among other things, so I find it much
easier porting it across platforms rather than rewriting the whole thing on a different language.
It turns out I was erroneously setting the result line "HTTP/1.0 200 OK" instead of letting
Apache do so, as Nick has kindly pointed out. I'm now unstuck (if that is a word), and progressing
:)
I do appreciate the time you've taken in answering me, though. Thanks again.
Take care,
Diego

________________________________
> From: bobcole@mac.com
> Date: Mon, 30 Aug 2010 10:42:25 -0500
> To: users@httpd.apache.org
> Subject: [users@httpd] Enabling CGI on Apache 2.2 on Mac OS X 10.6.4
>
> Diego,
> I, too, am learning about cgi programs on Mac OS X 10.6.4. Here are the
> steps I follow.
>
> 1) First, create a program file in the
> /Library/WebServer/CGI-Executables folder.
> Here is one that I find helpful. Put the following into a file such
> as myenvvars.pl
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> foreach $key (keys %ENV) {
> print "$key --> $ENV{$key}
";
> }
>
> If you prefer to use php, here is a similar program you might call
> myglobalvars.php
> #!/usr/bin/php
>> print "Content-type: text/html\n\n";
> print "";
> print "GLOBALS Variables:";
> foreach($GLOBALS as $key=>$value) {
> print "
\$GLOBALS[\"$key\"] == $value";
> print "
Count: " . count($GLOBALS[$key]);
> }
> print "";
> ?>
>
> 2) Using the Terminal program, change directory to
> cd /Library/WebServer/CGI-Executables
> then list the contents:
> ls -l
> and make sure the permissions are set so the file may be executed
> (rwxr-xr-x).
> If not, then change the permissions with
> chmod a+x myenvvars.pl (or you could use
> chmod 755 myenvvars.pl).
>
> 3) access the cgi file with a browser:
> http:/localhost/cgi-bin/myenvvars.pl
>
> The Console program is in the /Applications/Utilities folder. With
> that program you can look at the Apache access and error log files
> (click the triangle next to /private/var/log).
> The Apache httpd.conf file is in the /etc/apache2/ directory.
> I have not tried to change the location of the CGIs so I can't help
> with that aspect of your question.
>
> HTH,
> Bob
>
>
> --- Original Message ---
> From: Diego Sebastián Birch
>>
> Date: August 30, 2010 8:48:44 AM CDT
>
> Hello everyone,
> I've recently started developing applications on a Mac OS X, and one of
> them is a migration from a C++ CGI written for MS Windows. Porting it
> has been more or less fine, but I'm stuck with actually executing my
> program as a CGI. All I have managed to do is download my binary image
> several times.
> Unfortunately, I am new to Mac OS / POSIX / Apache development,
> although I have a fair knowledge of similar concepts on MS Windows
> running IIS.
> So far, what I have done is:1) Write a small application that outputs
> "HTTP/1.0 200 OK\r\nContent-type: text/plain\r\nContent-length:
> 33\r\n\r\nProbando un CGI superchorra" (which is Spanish for, more or
> less, "testing a really silly CGI") to the standard output.2) Build it
> and place the executable file in "/Library/WebServer/CGI-Executables"3)
> Attempt to access the file viahttp://localhost/cgi-bin/testcgi.cgi
> After spending a few hours trying different things I've read in
> different places, without really knowing what I was doing, I have
> managed to either download a binary image of the file, or get an HTTP
> 500 error, but I don't even know where to look for the log files in
> order to try to analize the cause.
> Would anyone be so kind as to explain to me what steps I need to take
> in order to enable CGIs on a specific user folder, taking into account
> Apple's efforts in hiding all configuration files and such from me?
> Thanks for the time taken to read this, and for whatever time you might
> take in trying to help me.
> Best regards,
> Diego
>
 		 	   		  
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message