From deedsmis at aculink.net Fri Jan 4 05:56:27 2002 From: deedsmis at aculink.net (SoloCDM) Date: Thu Aug 5 00:18:07 2004 Subject: From BASH to Perl Message-ID: <200201041156.g04BuRh18919@cdm01.deedsmiscentral.net> I am completely new to Perl, but not this list. I have a BASH script that I want to translate to Perl, so I started with the find command. I found a find2perl perl script, which created the following script from, "find2perl [directory] -type f -xdev -fstype ext2 \( -name '*personal*' -o -name '.*personal*' \) -print": ===================== Begin ===================== #! /usr/bin/perl -w eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; #$running_under_some_shell use strict; use File::Find (); # Set the variable $File::Find::dont_use_nlink if you're using AFS, # since AFS cheats. # for the convenience of &wanted calls, including -eval statements: use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; # Traverse desired filesystems File::Find::find({wanted => \&wanted}, '[directory]'); exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -f _ && !($File::Find::prune |= ($dev != $File::Find::topdev)) && ($dev >= 0) && ( /^.*personal.*\z/s || /^\..*personal.*\z/s ) && print("$name\n"); } ===================== End ===================== I was startled to find more than was necessary and some extra commands that I hadn't counted on (sub wanted { list }, use, eval, if). I understand the reason for the eval and if statements, but again I know little of them. I hadn't realized, until now, that it was necessary to have the use commands. Nevertheless, when I executed the script, nothing was produced by the script. The actual BASH find command was, "find [directory] -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print", which is piped into a while command in BASH with quotes around the filenames, because there are spaces in the filenames (filenames actually represented by variables in the BASH script). One of my main concerns is manipulating a file and its data with the find and loop commands to the end of each file. I did find, in Perl In A Nutshell by O'Reilly, where the following can manipulate the file: while () { print OUTFILE, "$_\n"; } I believe I understand $_ is the name as the input files data with a return on the end. -- Note: When you reply to this message, please include the mailing list/newsgroup address and my email address in To:. ********************************************************************* Signed, SoloCDM From aksuska at webflyer.com Fri Jan 4 13:03:25 2002 From: aksuska at webflyer.com (Keary Suska) Date: Thu Aug 5 00:18:07 2004 Subject: From BASH to Perl In-Reply-To: <200201041156.g04BuRh18919@cdm01.deedsmiscentral.net> Message-ID: It is not necessary to emulate Unix commands in your Perl script unless you are specifically trying to avoid launching a subshell. One of many simple ways to do what you want in perl: # $directory would be acquired from command line or whatever $command = "find $directory -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print" # open pipe from system command open FIND, "$command |" or die $! while( ) { # $_ will have each file name found with full path name # do what you want with it here } close FIND; That's it. There are security and robustness considerations (checking path, untainting input, checking SIGPIPE), but this is essentially all that is needed. Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet" > From: SoloCDM > Reply-To: , > Date: Fri, 4 Jan 2002 04:56:27 -0700 > To: Pikes Peak Perl Mongers (Majordomo) > > Subject: From BASH to Perl > > I am completely new to Perl, but not this list. I have a BASH script > that I want to translate to Perl, so I started with the find command. > > I found a find2perl perl script, which created the following script > from, "find2perl [directory] -type f -xdev -fstype ext2 \( -name > '*personal*' -o -name '.*personal*' \) -print": > > ===================== Begin ===================== > #! /usr/bin/perl -w > eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' > if 0; #$running_under_some_shell > > use strict; > use File::Find (); > > # Set the variable $File::Find::dont_use_nlink if you're using AFS, > # since AFS cheats. > > # for the convenience of &wanted calls, including -eval statements: > use vars qw/*name *dir *prune/; > *name = *File::Find::name; > *dir = *File::Find::dir; > *prune = *File::Find::prune; > > > # Traverse desired filesystems > File::Find::find({wanted => \&wanted}, '[directory]'); > exit; > > sub wanted { > my ($dev,$ino,$mode,$nlink,$uid,$gid); > > (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && > -f _ && > !($File::Find::prune |= ($dev != $File::Find::topdev)) && > ($dev >= 0) && > ( > /^.*personal.*\z/s > || > /^\..*personal.*\z/s > ) && > print("$name\n"); > } > ===================== End ===================== > > I was startled to find more than was necessary and some extra > commands that I hadn't counted on (sub wanted { list }, use, > eval, if). I understand the reason for the eval and if statements, > but again I know little of them. I hadn't realized, until now, > that it was necessary to have the use commands. Nevertheless, > when I executed the script, nothing was produced by the script. > > The actual BASH find command was, "find [directory] -type f -ls > -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' > \) -print", which is piped into a while command in BASH with quotes > around the filenames, because there are spaces in the filenames > (filenames actually represented by variables in the BASH script). > > One of my main concerns is manipulating a file and its data with > the find and loop commands to the end of each file. > > I did find, in Perl In A Nutshell by O'Reilly, where the following > can manipulate the file: > > while () { > print OUTFILE, "$_\n"; > } > > I believe I understand $_ is the name as the input files data with > a return on the end. > > -- > Note: When you reply to this message, please include the mailing > list/newsgroup address and my email address in To:. > > ********************************************************************* > Signed, > SoloCDM > From deedsmis at aculink.net Mon Jan 7 01:25:24 2002 From: deedsmis at aculink.net (SoloCDM) Date: Thu Aug 5 00:18:07 2004 Subject: Fouled Script Message-ID: <3C394D64.B2321D07@cdm01.deedsmiscentral.net> The attached script is my first attempt at some means of perl scripting, base on your advice. It won't work. I keep getting the following error: syntax error at ./find-perl-sample2 line 8, near "open " Execution of ./find-perl-sample2 aborted due to compilation errors. -- Note: When you reply to this message, please include the mailing list/newsgroup address and my email address in To:. ********************************************************************* Signed, SoloCDM -------------- next part -------------- #!/usr/bin/perl -w # $MDIR = [directory] $MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print" open FIND, "$MFILES |" or die $! while( ) { print "$_\n"; } close FIND; From has3 at usa.net Mon Jan 7 08:58:32 2002 From: has3 at usa.net (Harry Schroeder) Date: Thu Aug 5 00:18:07 2004 Subject: Fouled Script References: <3C394D64.B2321D07@cdm01.deedsmiscentral.net> Message-ID: <3C39B798.5080400@usa.net> Check for missing semi colons. Has3 SoloCDM wrote: >The attached script is my first attempt at some means of perl >scripting, base on your advice. It won't work. I keep getting the >following error: > >syntax error at ./find-perl-sample2 line 8, near "open " >Execution of ./find-perl-sample2 aborted due to compilation errors. > > >------------------------------------------------------------------------ > >#!/usr/bin/perl -w ># > >$MDIR = [directory] >$MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print" > >open FIND, "$MFILES |" or die $! >while( ) { > print "$_\n"; >} >close FIND; > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pikes-peak-pm/attachments/20020107/119c401c/attachment.htm From ssmythe at docent.com Mon Jan 7 08:57:12 2002 From: ssmythe at docent.com (Steve Smythe) Date: Thu Aug 5 00:18:07 2004 Subject: Fouled Script Message-ID: Semi-colons are needed after the variable assignments and your open statement. Also, you should use: $MDIR = "directoryname"; And not an array definition as you have below. I'm not on any unix machines at the moment, but eyeballing it, that looks like pretty much it. Steve -----Original Message----- From: owner-colorado-springs-pm-list@pm.org [mailto:owner-colorado-springs-pm-list@pm.org]On Behalf Of Harry Schroeder Sent: Monday, January 07, 2002 6:59 AM To: deedsmis@aculink.net; pikes-peak-pm-list@happyfunball.pm.org Cc: Keary Suska Subject: Re: Fouled Script Check for missing semi colons. Has3 SoloCDM wrote: The attached script is my first attempt at some means of perl scripting, base on your advice. It won't work. I keep getting the following error: syntax error at ./find-perl-sample2 line 8, near "open " Execution of ./find-perl-sample2 aborted due to compilation errors. _____ #!/usr/bin/perl -w # $MDIR = [directory] $MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print" open FIND, "$MFILES |" or die $! while( ) { print "$_\n"; } close FIND; -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pikes-peak-pm/attachments/20020107/05d29409/attachment.htm From tbcatwork at yahoo.com Mon Jan 7 15:08:26 2002 From: tbcatwork at yahoo.com (Tim Chambers) Date: Thu Aug 5 00:18:07 2004 Subject: Perl lunch this Thursday Message-ID: <004e01c197bf$73ac3d60$80441d82@TC5570P> Mark your calendars now. WHAT: monthly Pikes Peak Perl Mongers lunch WHERE: TBD WHEN: Thursday, 1/10, at 11:30 Any suggestions for where to meet? <>< Tim From jtevans at kilnar.com Mon Jan 7 19:44:26 2002 From: jtevans at kilnar.com (John Evans) Date: Thu Aug 5 00:18:07 2004 Subject: Perl lunch this Thursday In-Reply-To: <004e01c197bf$73ac3d60$80441d82@TC5570P> Message-ID: On Mon, 7 Jan 2002, Tim Chambers wrote: > Mark your calendars now. > > WHAT: monthly Pikes Peak Perl Mongers lunch > WHERE: TBD > WHEN: Thursday, 1/10, at 11:30 > > Any suggestions for where to meet? > I should be able to make it. I have a physical that morning, but it should be over by 10 at the latest. My mind is totally blank on a place to eat, so I'll leave it up to the czar. :) -- John Evans http://jtevans.kilnar.com/ -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s++:- a- C+++>++++ ULSB++++$ P+++$ L++++$ E--- W++ N+ o? K? w O- M V PS+ !PE Y+ PGP t(--) 5-- X++(+++) R+++ tv+ b+++(++++) DI+++ D++>+++ G+ e h--- r+++ y+++ ------END GEEK CODE BLOCK------ From deedsmis at aculink.net Tue Jan 8 05:24:07 2002 From: deedsmis at aculink.net (SoloCDM) Date: Thu Aug 5 00:18:07 2004 Subject: Fouled Script References: <3C394D64.B2321D07@cdm01.deedsmiscentral.net> <20020107095707.GA8160@pcisys.net> Message-ID: <3C3AD6D7.D5EF7005@cdm01.deedsmiscentral.net> Eric Schwartz stated the following: > > On Mon, Jan 07, 2002 at 12:25:24AM -0700, SoloCDM wrote: > > > The attached script is my first attempt at some means of perl > > scripting, base on your advice. It won't work. I keep getting the > > following error: > > > syntax error at ./find-perl-sample2 line 8, near "open " Execution > > of ./find-perl-sample2 aborted due to compilation errors. > > Unquoted string "directory" may clash with future reserved word at > find-perl-sample line 4. Scalar found where operator expected at > find-perl-sample line 5, near "$MFILES" (Missing semicolon on previous > line?) syntax error at find-perl-sample line 5, near "$MFILES " > find-perl-sample had compilation errors. > > Essentially, you're missing a bunch of semicolons, and if [directory] > isn't what you really put there, you should tell us, so we know > what you actually are asking about. Otherwise, you should quote it > properly. Furthermore, by using [directory], you're creating an > arrayref, and I don't think that's what you wanted to do there. Now I am getting the error below with the attached file: sh: -c: line 1: syntax error near unexpected token `(' sh: -c: line 1: `find / -type f -ls -xdev -fstype ext2 ( -iname '*personal*' -o -iname '.*personal*' ) -print' I hope all the semicolons are in place; although, previously to sending the first posting -- I put all the semicolons as expected, but I still didn't get a correct response from the script. -- Note: When you reply to this message, please include the mailing list/newsgroup address and my email address in To:. ********************************************************************* Signed, SoloCDM -------------- next part -------------- #!/usr/bin/perl -w # $MDIR = "/"; $MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print"; open FIND, "$MFILES |" or die $!; while( ) { # $_ will have each file name found with full path name # do what you want with it here print "$_\n"; } close FIND; From has3 at usa.net Tue Jan 8 08:56:53 2002 From: has3 at usa.net (Harry Schroeder) Date: Thu Aug 5 00:18:07 2004 Subject: Fouled Script References: <3C394D64.B2321D07@cdm01.deedsmiscentral.net> <20020107095707.GA8160@pcisys.net> <3C3AD6D7.D5EF7005@cdm01.deedsmiscentral.net> Message-ID: <3C3B08B5.2020309@usa.net> You will most likely see the problem if you use the perl debugger and x $MFILES after the assignment. Because you are using "'s , the \( is interpreted differently than you probably expect. Take a look at the variable in the debugger, and you will understand. To fix try \\( and \\) . Harry SoloCDM wrote: >Eric Schwartz stated the following: > >>On Mon, Jan 07, 2002 at 12:25:24AM -0700, SoloCDM wrote: >> >>>The attached script is my first attempt at some means of perl >>>scripting, base on your advice. It won't work. I keep getting the >>>following error: >>> >>>syntax error at ./find-perl-sample2 line 8, near "open " Execution >>>of ./find-perl-sample2 aborted due to compilation errors. >>> >>Unquoted string "directory" may clash with future reserved word at >>find-perl-sample line 4. Scalar found where operator expected at >>find-perl-sample line 5, near "$MFILES" (Missing semicolon on previous >>line?) syntax error at find-perl-sample line 5, near "$MFILES " >>find-perl-sample had compilation errors. >> >>Essentially, you're missing a bunch of semicolons, and if [directory] >>isn't what you really put there, you should tell us, so we know >>what you actually are asking about. Otherwise, you should quote it >>properly. Furthermore, by using [directory], you're creating an >>arrayref, and I don't think that's what you wanted to do there. >> > >Now I am getting the error below with the attached file: > >sh: -c: line 1: syntax error near unexpected token `(' >sh: -c: line 1: `find / -type f -ls -xdev -fstype ext2 ( -iname >'*personal*' -o -iname '.*personal*' ) -print' > >I hope all the semicolons are in place; although, previously to >sending the first posting -- I put all the semicolons as expected, but >I still didn't get a correct response from the script. > > >------------------------------------------------------------------------ > >#!/usr/bin/perl -w ># > >$MDIR = "/"; >$MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' \) -print"; > >open FIND, "$MFILES |" or die $!; >while( ) { > # $_ will have each file name found with full path name > # do what you want with it here > print "$_\n"; >} >close FIND; > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pikes-peak-pm/attachments/20020108/aa863ec3/attachment.htm From aksuska at webflyer.com Tue Jan 8 11:30:11 2002 From: aksuska at webflyer.com (Keary Suska) Date: Thu Aug 5 00:18:07 2004 Subject: Fouled Script In-Reply-To: <3C3AD6D7.D5EF7005@cdm01.deedsmiscentral.net> Message-ID: This is a problem with the find command. You must escape the parens to the shell, which looks like what you intend, but in Perl the use of double quotes causes the escapes to be unescaped. Try: $MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \\( -iname '*personal*' -o -iname '.*personal*' \\) -print"; Also be aware that the -ls action will provide extraneous information to the file name, so if you plan to manipulate the file in your script you might have to extract the file name or simply not use -ls. Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet" > From: SoloCDM > Reply-To: deedsmis@aculink.net, pikes-peak-pm-list@happyfunball.pm.org > Date: Tue, 08 Jan 2002 04:24:07 -0700 > To: "Pikes Peak Perl Mongers (Majordomo)" > > Cc: Eric Schwartz , Harry Schroeder , Steve > Smythe > Subject: Re: Fouled Script > > Eric Schwartz stated the following: >> >> On Mon, Jan 07, 2002 at 12:25:24AM -0700, SoloCDM wrote: >> >>> The attached script is my first attempt at some means of perl >>> scripting, base on your advice. It won't work. I keep getting the >>> following error: >> >>> syntax error at ./find-perl-sample2 line 8, near "open " Execution >>> of ./find-perl-sample2 aborted due to compilation errors. >> >> Unquoted string "directory" may clash with future reserved word at >> find-perl-sample line 4. Scalar found where operator expected at >> find-perl-sample line 5, near "$MFILES" (Missing semicolon on previous >> line?) syntax error at find-perl-sample line 5, near "$MFILES " >> find-perl-sample had compilation errors. >> >> Essentially, you're missing a bunch of semicolons, and if [directory] >> isn't what you really put there, you should tell us, so we know >> what you actually are asking about. Otherwise, you should quote it >> properly. Furthermore, by using [directory], you're creating an >> arrayref, and I don't think that's what you wanted to do there. > > Now I am getting the error below with the attached file: > > sh: -c: line 1: syntax error near unexpected token `(' > sh: -c: line 1: `find / -type f -ls -xdev -fstype ext2 ( -iname > '*personal*' -o -iname '.*personal*' ) -print' > > I hope all the semicolons are in place; although, previously to > sending the first posting -- I put all the semicolons as expected, but > I still didn't get a correct response from the script. > > -- > Note: When you reply to this message, please include the mailing > list/newsgroup address and my email address in To:. > > ********************************************************************* > Signed, > SoloCDM > #!/usr/bin/perl -w > # > > $MDIR = "/"; > $MFILES = "find $MDIR -type f -ls -xdev -fstype ext2 \( -iname '*personal*' -o > -iname '.*personal*' \) -print"; > > open FIND, "$MFILES |" or die $!; > while( ) { > # $_ will have each file name found with full path name > # do what you want with it here > print "$_\n"; > } > close FIND; > From dave.waddell at wcom.com Wed Jan 9 11:39:29 2002 From: dave.waddell at wcom.com (David R. Waddell) Date: Thu Aug 5 00:18:07 2004 Subject: From BASH to Perl In-Reply-To: References: <200201041156.g04BuRh18919@cdm01.deedsmiscentral.net> Message-ID: <3.0.6.32.20020109103929.007e22f0@pop.mcit.com> I think find2perl is a hack for windoz os'es. As Keary indicates there are better ways on a Unix box. At 12:03 PM 1/4/02 -0700, Keary Suska wrote: >It is not necessary to emulate Unix commands in your Perl script unless you >are specifically trying to avoid launching a subshell. One of many simple >ways to do what you want in perl: > ># $directory would be acquired from command line or whatever >$command = "find $directory -type f -ls -xdev -fstype ext2 \( -iname >'*personal*' -o -iname '.*personal*' \) -print" > ># open pipe from system command >open FIND, "$command |" or die $! >while( ) { > # $_ will have each file name found with full path name > # do what you want with it here >} >close FIND; > >That's it. There are security and robustness considerations (checking path, >untainting input, checking SIGPIPE), but this is essentially all that is >needed. > >Keary Suska >Esoteritech, Inc. >"Leveraging Open Source for a better Internet" > >> From: SoloCDM >> Reply-To: , >> Date: Fri, 4 Jan 2002 04:56:27 -0700 >> To: Pikes Peak Perl Mongers (Majordomo) >> >> Subject: From BASH to Perl >> >> I am completely new to Perl, but not this list. I have a BASH script >> that I want to translate to Perl, so I started with the find command. >> >> I found a find2perl perl script, which created the following script >> from, "find2perl [directory] -type f -xdev -fstype ext2 \( -name >> '*personal*' -o -name '.*personal*' \) -print": >> >> ===================== Begin ===================== >> #! /usr/bin/perl -w >> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' >> if 0; #$running_under_some_shell >> >> use strict; >> use File::Find (); >> >> # Set the variable $File::Find::dont_use_nlink if you're using AFS, >> # since AFS cheats. >> >> # for the convenience of &wanted calls, including -eval statements: >> use vars qw/*name *dir *prune/; >> *name = *File::Find::name; >> *dir = *File::Find::dir; >> *prune = *File::Find::prune; >> >> >> # Traverse desired filesystems >> File::Find::find({wanted => \&wanted}, '[directory]'); >> exit; >> >> sub wanted { >> my ($dev,$ino,$mode,$nlink,$uid,$gid); >> >> (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && >> -f _ && >> !($File::Find::prune |= ($dev != $File::Find::topdev)) && >> ($dev >= 0) && >> ( >> /^.*personal.*\z/s >> || >> /^\..*personal.*\z/s >> ) && >> print("$name\n"); >> } >> ===================== End ===================== >> >> I was startled to find more than was necessary and some extra >> commands that I hadn't counted on (sub wanted { list }, use, >> eval, if). I understand the reason for the eval and if statements, >> but again I know little of them. I hadn't realized, until now, >> that it was necessary to have the use commands. Nevertheless, >> when I executed the script, nothing was produced by the script. >> >> The actual BASH find command was, "find [directory] -type f -ls >> -xdev -fstype ext2 \( -iname '*personal*' -o -iname '.*personal*' >> \) -print", which is piped into a while command in BASH with quotes >> around the filenames, because there are spaces in the filenames >> (filenames actually represented by variables in the BASH script). >> >> One of my main concerns is manipulating a file and its data with >> the find and loop commands to the end of each file. >> >> I did find, in Perl In A Nutshell by O'Reilly, where the following >> can manipulate the file: >> >> while () { >> print OUTFILE, "$_\n"; >> } >> >> I believe I understand $_ is the name as the input files data with >> a return on the end. >> >> -- >> Note: When you reply to this message, please include the mailing >> list/newsgroup address and my email address in To:. >> >> ********************************************************************* >> Signed, >> SoloCDM >> > > From tbcatwork at yahoo.com Wed Jan 9 12:14:14 2002 From: tbcatwork at yahoo.com (Tim Chambers) Date: Thu Aug 5 00:18:07 2004 Subject: Perl lunch this Thursday References: Message-ID: <00cc01c19939$726fa6f0$80441d82@TC5570P> Well, since I've received no suggestions, here's the plan: WHAT: monthly Pikes Peak Perl Mongers lunch WHERE: Chipotle, Garden of the Gods Rd & Centennial WHEN: Thursday, 1/10, at 11:30 I've been wanting to try Chipotle. <>< Tim 719 590 5570 telephone 719 651 0116 cellular From ssmythe at docent.com Thu Jan 10 18:33:41 2002 From: ssmythe at docent.com (Steve Smythe) Date: Thu Aug 5 00:18:07 2004 Subject: PHP and Apache win32? Message-ID: I've heard PHP is a better technology for forms handling with a database, and I've been trying to get it installed on my desktop working with win32 Apache. Anyone had luck doing this? I've gotten it to run simple scripts as a CGI script, but it's displaying the first sh-bang line "#!c:/php/php". Very annoying. The command line execution of the script works just fine and displays the proper "Content-type: text/html" header instead of the sh-bang line. What's going on? Steve Steve Smythe Sr. CM Engineer ssmythe@docent.com W:650-934-9546 C:925-699-6822 Docent, Inc. 2444 Charleston Road Mountain View, CA 94043-1622 http://www.docent.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pikes-peak-pm/attachments/20020110/974a82fe/attachment.htm From cmiltonperl at yahoo.com Thu Jan 10 19:09:01 2002 From: cmiltonperl at yahoo.com (Christopher Milton) Date: Thu Aug 5 00:18:07 2004 Subject: PHP and Apache win32? In-Reply-To: Message-ID: <20020111010901.55324.qmail@web20802.mail.yahoo.com> --- Steve Smythe wrote: > I've heard PHP is a better technology for forms handling with a > database, and I've been trying to get it installed on my desktop > working with win32 Apache. Anyone had luck doing this? I've > gotten it to run simple scripts as a CGI script, but it's displaying > the first sh-bang line "#!c:/php/php". Very annoying. The > command line execution of the script works just fine and > displays the proper "Content-type: text/html" header instead > of the sh-bang line. What's going on? Did you configure Apache to recognize that you're using PHP? http://www.php.net/manual/en/faq.installation.php I don't think you even need the hashbang with a correct Apache configuration. That being said, this is a Perl list, not a PHP list. ===== Christopher M. Milton cmiltonperl@yahoo.com Phone 719/380-7665 Colorado Springs, CO __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ From jtevans at kilnar.com Thu Jan 10 19:49:40 2002 From: jtevans at kilnar.com (John Evans) Date: Thu Aug 5 00:18:07 2004 Subject: PHP and Apache win32? In-Reply-To: Message-ID: On Thu, 10 Jan 2002, Steve Smythe wrote: > I've heard PHP is a better technology for forms handling with a > database, and I've been trying to get it installed on my desktop > working with win32 Apache. Anyone had luck doing this? I've > gotten it to run simple scripts as a CGI script, but it's displaying > the first sh-bang line "#!c:/php/php". Very annoying. The > command line execution of the script works just fine and > displays the proper "Content-type: text/html" header instead > of the sh-bang line. What's going on? > The easiest way of getting Apache, PHP and a database (MySQL) setup on a Win32 machine is PHPTriad. Great package. Not sure if I would trust it to a production environment, but I don't trust Windows to do any kind of production tasks with any sort of reliability, speed or security. http://sourceforge.net/projects/phptriad/ -- John Evans http://jtevans.kilnar.com/ -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s++:- a- C+++>++++ ULSB++++$ P+++$ L++++$ E--- W++ N+ o? K? w O- M V PS+ !PE Y+ PGP t(--) 5-- X++(+++) R+++ tv+ b+++(++++) DI+++ D++>+++ G+ e h--- r+++ y+++ ------END GEEK CODE BLOCK------ From matt.long at matthew-long.com Thu Jan 10 20:11:10 2002 From: matt.long at matthew-long.com (Matthew J. Long) Date: Thu Aug 5 00:18:07 2004 Subject: PHP and Apache win32? References: Message-ID: <00b501c19a45$3dd5d790$1400a8c0@ebiztech.com> What version of Apache are you using? I'm not sure that PHP is working properly under Apache 2 for Win32 yet. I had trouble with that one myself, but it's been a month or so since I tried. Things may have changed. The instructions (http://www.php.net/manual/en/install.windows.php - Manual setup not InstallShield) on the PHP site are pretty thorough for setting it up, so if you're following those and it still doesn't work you may want to try an earlier version of Apache. -Matt p.s. How's Cali treating you? ----- Original Message ----- From: Steve Smythe To: Pikes Peak Perl Mongers (E-mail) Sent: Thursday, January 10, 2002 5:33 PM Subject: PHP and Apache win32? I've heard PHP is a better technology for forms handling with a database, and I've been trying to get it installed on my desktop working with win32 Apache. Anyone had luck doing this? I've gotten it to run simple scripts as a CGI script, but it's displaying the first sh-bang line "#!c:/php/php". Very annoying. The command line execution of the script works just fine and displays the proper "Content-type: text/html" header instead of the sh-bang line. What's going on? Steve Steve Smythe Sr. CM Engineer ssmythe@docent.com W:650-934-9546 C:925-699-6822 Docent, Inc. 2444 Charleston Road Mountain View, CA 94043-1622 http://www.docent.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pikes-peak-pm/attachments/20020110/019be31c/attachment.htm From ssmythe at docent.com Mon Jan 14 09:15:20 2002 From: ssmythe at docent.com (Steve Smythe) Date: Thu Aug 5 00:18:07 2004 Subject: PHP and Apache win32? Message-ID: Hey Guys, Thanks for all the responses! (I realize this is a PHP question and not a Perl question. I knew many folks are multi-lingual on this list and hoped for the best. No offense intended. Really! :-) I tried the PHPtriad release and the MySQL didn't even work out of the box. However, the configuration for PHP did work. Below is an included configuration file for Apache that works for PHP. The basic setup I'm running now is: Apache 1.3, PHP 4.11, and MySQL 3.23.46. Apache installed at c:\apache PHP installed at c:\apache\php MySQL installed at c:\mysql I append the following line to the end of httpd.conf: Include c:/apache/conf/php-apache.conf The included file contents are: # # Apache config for PHP: # DirectoryIndex index.html DirectoryIndex index.htm DirectoryIndex index.php DirectoryIndex index.php3 DirectoryIndex default.html DirectoryIndex default.htm ScriptAlias /cgi-bin/ "c:/apache/cgi-bin/" ScriptAlias /php/ "c:/apache/php/" AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php-source .phps Action application/x-httpd-php /php/php.exe Thanks again! I really appreciate it! Steve From tbcatwork at yahoo.com Wed Jan 23 10:24:24 2002 From: tbcatwork at yahoo.com (Tim Chambers) Date: Thu Aug 5 00:18:07 2004 Subject: vote: EDN Innovation of the Year Message-ID: <001701c1a42a$6c5e36e0$80441d82@TC5570P> My employer's products, the 1680 and 1690 series of logic analyzers, are nominated for EDN's Innovation of the Year for 2001: http://www.e-insite.net/ednmag/InnovationBallot.asp. There are some other cool innovations to vote for as well. Spread the word, if you wouldn't mind. <>< Tim