Re: Humble questions for web developers in freebsd.

2004-08-23 Thread Charles Ulrich
Mark Jayson Alvarez said:
 4. Do you happen know any good link where I can learn
 how to write shell scripts so that I may be able to
 start an application at boot time by putting it in
 /usr/local/etc/rc.d (ex: httpd)

Here's one that I reference quite frequently:

http://steve-parker.org/sh/sh.shtml

See also the man page for sh. (FreeBSD man pages are really quite good. You
would do well to become familiar with them.) You have to be careful when you
look around for documentation on the Bourne Shell (sh), however, because the
vast majority of the shell scripting docs on the web are written for the
Bourne *Again* Shell (bash). bash contains numerous features that not present
in sh. You can use bash to write your own scripts, but all of FreeBSD's shell
scripts are written for sh.

 I'm just a fresh graduate and I'm still learning many
 things by myself in preparation for future career in
 IT. it's a sad fact, but I may have to admit that my
 professors in college have just thought us the
 basics in our field. Any help coming from you would
 be very much appreciated...

That's typically how it goes in college. They give you the theory but the
implementation is up to you. By learning FreeBSD, you've already got a leg up
on your peers. Just having FreeBSD and Linux on my resume got me a couple of
interviews from prospective employers running pure Windows shops because they
believed that experienced Unix people typically have a better understanding of
how computers and networks actually work than your average Windows person. And
they're absolutely right.

-- 
Charles Ulrich
System Administrator
Ideal Solution - http://www.idealso.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Humble questions for web developers in freebsd.

2004-08-20 Thread Mark Jayson Alvarez
Greetings, 
 
  I have installed the latest Apache http server
for the first time and I have just started programming
perl cgi scripts as well. It didn't brought me any
trouble installing it, but when I wrote my first
Hello World cgi script, I end up with an internal
server error. Eventually (through a very intensive,
sleepless researching), I was able to run it
successfully  
in a browser after changing its mode to 755(whiew!). 
 
Questions: 
1. Do I always have to do this for every script that I
would make? I thought, apache web server will know how
to execute those files if it sees something like
#!/usr/local/bin/perl in the beginning of the file. 
 
2. I'm having a small clue on this one. The perl
book(Beginning Perl) told me that in a default
installation, apache is started by nobody(after
runningps -aux |grep httpd, I can see at least five
httpd processes run by nobody and one that is run by
me(root).) --if it is run by nobody, then it can't run
the cgi script I have written right? Elucidate me
please.  (And also those 5 nobody's) 
 
 
Few perl/html questions(...related to freebsd :=): 
 
1. (hmm.. just curious) Can't I start writing a perl
program or just a plain text file that already has a
755 mode?(ex: vi  -m 755... hello.plx) 
 
2. Do you know how can I run a perl program in freebsd
without having it preceded with the word perl? 
(I tried changing its mode to 755 and also putting it
to /usr/local/bin but it didn't work(don't laugh at me
please.. I'm still learning:=). 
 
3. If you happened to be one, I'm already having a
picture of how web developers are creating web pages
or cgi scripts(because the whole apache directory is
owned by the root, they would have to write them
outside and then transfer them inside when they are
finish, am I correct?? Because what I did was, change
the ownership of the entire apache directory for me to
be able to save an html file or a cgi script in it... 
 
4. Do you happen know any good link where I can learn
how to write shell scripts so that I may be able to
start an application at boot time by putting it in
/usr/local/etc/rc.d (ex: httpd) 
 
I'm just a fresh graduate and I'm still learning many
things by myself in preparation for future career in
IT. it's a sad fact, but I may have to admit that my
professors in college have just thought us the
basics in our field. Any help coming from you would
be very much appreciated... 
 
And again, thanks a lot. 
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Humble questions for web developers in freebsd.

2004-08-20 Thread Bill Moran
Mark Jayson Alvarez [EMAIL PROTECTED] wrote:
 Greetings, 
  
   I have installed the latest Apache http server
 for the first time and I have just started programming
 perl cgi scripts as well. It didn't brought me any
 trouble installing it, but when I wrote my first
 Hello World cgi script, I end up with an internal
 server error. Eventually (through a very intensive,
 sleepless researching), I was able to run it
 successfully  
 in a browser after changing its mode to 755(whiew!). 
  
 Questions: 
 1. Do I always have to do this for every script that I
 would make? I thought, apache web server will know how
 to execute those files if it sees something like
 #!/usr/local/bin/perl in the beginning of the file.

No.  Apache needs to know that those script should be executed instead
of sent as-is to the browser.  This is more a Unix thing than a CGI thing.
Scripts should always have execute permissions on them, but Apache can be
configured to work around this by identifying the type of file and
handling it properly.  Lots of docs available for reading, especially on
Apache's config.

 2. I'm having a small clue on this one. The perl
 book(Beginning Perl) told me that in a default
 installation, apache is started by nobody(after
 runningps -aux |grep httpd, I can see at least five
 httpd processes run by nobody and one that is run by
 me(root).) --if it is run by nobody, then it can't run
 the cgi script I have written right? Elucidate me
 please.  (And also those 5 nobody's) 

How did you install Apache?  Default Apache installs on FreeBSD use
user www and group www and no longer use nobody.

The first Apache process has to start as root to bind to port 80, but
any additional worker process should run as a non-priviledged user.
(usually user www on FreeBSD)

 1. (hmm.. just curious) Can't I start writing a perl
 program or just a plain text file that already has a
 755 mode?(ex: vi  -m 755... hello.plx) 

I don't see why not.

 2. Do you know how can I run a perl program in freebsd
 without having it preceded with the word perl? 
 (I tried changing its mode to 755 and also putting it
 to /usr/local/bin but it didn't work(don't laugh at me
 please.. I'm still learning:=).

Just call the program.  If it has X permissions for available for you
(the user you're trying to run it as) it will notice the #!/usr/bin/perl
at the head of the file an user perl to interpret the script.  I noticed
you had #!/usr/local/bin/perl in your earlier comments.  Use which perl
to find out the path to perl on your system and use that.  If that first
line has the wrong path, your scripts won't run.

 3. If you happened to be one, I'm already having a
 picture of how web developers are creating web pages
 or cgi scripts(because the whole apache directory is
 owned by the root, they would have to write them
 outside and then transfer them inside when they are
 finish, am I correct?? Because what I did was, change
 the ownership of the entire apache directory for me to
 be able to save an html file or a cgi script in it... 

Make each directory owned by the user doing development, and the group
of the web server (usually www, although it appears to be nobody in
your case).  Then the user can have full access to the file, and you
can give the group r-x permissions so it can read and execute it.

 4. Do you happen know any good link where I can learn
 how to write shell scripts so that I may be able to
 start an application at boot time by putting it in
 /usr/local/etc/rc.d (ex: httpd) 

The existing shell scripts in that directory, placed there by programs
you installed are a good start.

Otherwise, there's a section in the handbook on the rcng system that's
pretty informative.

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: Humble questions for web developers in freebsd.

2004-08-20 Thread Eric Crist
[EMAIL PROTECTED] wrote:

 2. Do you know how can I run a perl program in freebsd without having
 it preceded with the word perl? (I tried changing its mode to 755 and
 also putting it to /usr/local/bin but it didn't work(don't laugh at
me
 please.. I'm still learning:=).

 Just call the program.  If it has X permissions for available
 for you (the user you're trying to run it as) it will notice
 the #!/usr/bin/perl at the head of the file an user perl to
 interpret the script.  I noticed you had
 #!/usr/local/bin/perl in your earlier comments.  Use which
 perl to find out the path to perl on your system and use
 that.  If that first line has the wrong path, your scripts won't run.


Another point here.  If you're in the directory where this program
resides, you need to prepend a ./ before the command.  This is another
Unix thing, there to protect yourself from running the wrong command.
The ./ tells the system you want to run a program from the current
directory, and not something from within your PATH variable.

HTH

Eric F Crist
Best Access Systems
11300 Rupp Dr. Burnsville, MN 55337
Phone: 952.894.3830
Cell: 612.998.3588
Fax: 952-894-1990



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]