From ron at vnetworx.net Thu Mar 1 12:37:54 2012 From: ron at vnetworx.net (Ron Guerin) Date: Thu, 01 Mar 2012 12:37:54 -0500 Subject: [nycphp-talk] OS X home directory PHP-CLI In-Reply-To: <2589D9F4-AB7B-48DC-A543-07CA0185853B@beaffinitive.com> References: <4F4442B3.5010403@vnetworx.net> <2589D9F4-AB7B-48DC-A543-07CA0185853B@beaffinitive.com> Message-ID: <4F4FB3F2.9010602@vnetworx.net> (resent because it never made it back to me) On 02/22/2012 12:01 AM, Rob Marscher wrote: >> On Tue, Feb 21, 2012 at 8:19 PM, Ron Guerin > > wrote: >> >> I don't have a Mac, and I haven't turned up much useful in Google, so >> I'm hoping someone here has written a CLI PHP script for OS X. >> >> I understand that you can't count on HOME to be set. Is there a >> reliable way to find the user's home directory on OS X in PHP? > > On Feb 21, 2012, at 8:26 PM, Federico Ulfo wrote: >> $home_dir = exec( "cd ~ >> pwd" ); > > FWIW, $_ENV['HOME'] is set on my laptop. > > Here's Federico's technique on one line with backticks: > > $home = `cd ~; pwd`; I'd read somewhere that scripts launched from the GUI don't necessarily have HOME set in the environment. Perhaps that's not true, but I'll go with one of the suggestions you or Federico made in the event I don't find HOME. My thanks to both of you! - Ron From chsnyder at gmail.com Fri Mar 2 08:24:07 2012 From: chsnyder at gmail.com (Chris Snyder) Date: Fri, 2 Mar 2012 08:24:07 -0500 Subject: [nycphp-talk] PHP 5.4.0 Message-ID: PHP 5.4 is finally ready for the show. Have you used it? Any gotchas? http://php.net/releases/5_4_0.php It's a little thing, but I'm looking forward to being able to declare arrays using the short syntax: $items = []; No more register globals, no more magic quotes, and no more safe mode. Our little hypertext preprocessor is all grown up! Chris Snyder http://chxor.chxo.com/ From ant92083 at gmail.com Fri Mar 2 09:50:44 2012 From: ant92083 at gmail.com (Anthony W.) Date: Fri, 02 Mar 2012 09:50:44 -0500 Subject: [nycphp-talk] PHP 5.4.0 In-Reply-To: References: Message-ID: <4F50DE44.5020501@gmail.com> I am looking forward to array dereferencing from function return statements. function foo() { return array('awesomeness'=>'PHP'); } echo foo()['awesomeness']; -- Anthony W. ant92083 at gmail.com From rmarscher at beaffinitive.com Fri Mar 2 10:48:45 2012 From: rmarscher at beaffinitive.com (Rob Marscher) Date: Fri, 2 Mar 2012 10:48:45 -0500 Subject: [nycphp-talk] PHP 5.4.0 In-Reply-To: References: Message-ID: <642E6765-D854-4EFC-B584-E310D8A0510B@beaffinitive.com> On Mar 2, 2012, at 8:24 AM, Chris Snyder wrote: > It's a little thing, but I'm looking forward to being able to declare > arrays using the short syntax: > > $items = []; Me too. There was an RFC for javascript-style object literals which I was really excited about, but it was pretty much shot down. I was going to try to make a patch for it, but never found enough time to dig into how the parser works. https://wiki.php.net/rfc/objectarrayliterals I'm excited about Traits. http://php.net/manual/en/language.oop5.traits.php It removes the need for multiple levels of subclassing in some cases. From rainelemental at gmail.com Fri Mar 2 11:20:52 2012 From: rainelemental at gmail.com (Federico Ulfo) Date: Fri, 2 Mar 2012 11:20:52 -0500 Subject: [nycphp-talk] PHP 5.4.0 In-Reply-To: <642E6765-D854-4EFC-B584-E310D8A0510B@beaffinitive.com> References: <642E6765-D854-4EFC-B584-E310D8A0510B@beaffinitive.com> Message-ID: Short code, is cool $name = (new DB)->get_row()["name"]; Short array is nice [ "user" => [ "name" => "Neytiri", "color" => "blue", "language" => "Na-vi" ] ]; wrote: > > On Mar 2, 2012, at 8:24 AM, Chris Snyder wrote: > > > It's a little thing, but I'm looking forward to being able to declare > > arrays using the short syntax: > > > > $items = []; > > Me too. There was an RFC for javascript-style object literals which I was > really excited about, but it was pretty much shot down. I was going to try > to make a patch for it, but never found enough time to dig into how the > parser works. > https://wiki.php.net/rfc/objectarrayliterals > > I'm excited about Traits. > http://php.net/manual/en/language.oop5.traits.php It removes the need > for multiple levels of subclassing in some cases. > > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rainelemental at gmail.com Fri Mar 2 12:06:57 2012 From: rainelemental at gmail.com (Federico Ulfo) Date: Fri, 2 Mar 2012 12:06:57 -0500 Subject: [nycphp-talk] PHP 5.4.0 In-Reply-To: References: <642E6765-D854-4EFC-B584-E310D8A0510B@beaffinitive.com> Message-ID: I've to correct what I wrote before about traits. PHP 5.4 implements traits instead of multiple inheritance, because the multiple inheritance can cause the "diamond problem" http://en.wikipedia.org/wiki/Diamond_problem On Fri, Mar 2, 2012 at 11:20 AM, Federico Ulfo wrote: > Short code, is cool > $name = (new DB)->get_row()["name"]; > > Short array is nice > [ "user" => [ "name" => "Neytiri", "color" => "blue", "language" => > "Na-vi" ] ]; > > finally! > > I just don't get the syntax of traits, why not a simpler syntax, class C > extends A, B? > > > > Here is the complete ChangeLog: > http://php.net/ChangeLog-5.php > > > > On Fri, Mar 2, 2012 at 10:48 AM, Rob Marscher wrote: > >> >> On Mar 2, 2012, at 8:24 AM, Chris Snyder wrote: >> >> > It's a little thing, but I'm looking forward to being able to declare >> > arrays using the short syntax: >> > >> > $items = []; >> >> Me too. There was an RFC for javascript-style object literals which I >> was really excited about, but it was pretty much shot down. I was going to >> try to make a patch for it, but never found enough time to dig into how the >> parser works. >> https://wiki.php.net/rfc/objectarrayliterals >> >> I'm excited about Traits. >> http://php.net/manual/en/language.oop5.traits.php It removes the need >> for multiple levels of subclassing in some cases. >> >> >> _______________________________________________ >> New York PHP User Group Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> http://www.nyphp.org/show-participation >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsnyder at gmail.com Fri Mar 2 12:23:29 2012 From: chsnyder at gmail.com (Chris Snyder) Date: Fri, 2 Mar 2012 12:23:29 -0500 Subject: [nycphp-talk] PHP 5.4.0 In-Reply-To: References: <642E6765-D854-4EFC-B584-E310D8A0510B@beaffinitive.com> Message-ID: On Fri, Mar 2, 2012 at 12:06 PM, Federico Ulfo wrote: > I've to correct what I wrote before about traits. > > PHP?5.4 implements traits instead of multiple inheritance, because the > multiple inheritance can cause the "diamond problem" > http://en.wikipedia.org/wiki/Diamond_problem That article explains in detail how the problem is handled in other languages. And traits can still result in conflicts that look pretty darned similar to the diamond problem, which result in a fatal error. So I think your question is still a good one. Nevertheless, I'm glad we've got another way to reduce the amount of boilerplate in our classes. From david at davidmintz.org Mon Mar 5 13:02:28 2012 From: david at davidmintz.org (David Mintz) Date: Mon, 5 Mar 2012 13:02:28 -0500 Subject: [nycphp-talk] PHP 5.4.0 In-Reply-To: References: <642E6765-D854-4EFC-B584-E310D8A0510B@beaffinitive.com> Message-ID: On Fri, Mar 2, 2012 at 11:20 AM, Federico Ulfo wrote: > Short code, is cool > $name = (new DB)->get_row()["name"]; > > class member access on instantiation! Yay! -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From zippy1981 at gmail.com Fri Mar 9 09:16:14 2012 From: zippy1981 at gmail.com (Justin Dearing) Date: Fri, 9 Mar 2012 09:16:14 -0500 Subject: [nycphp-talk] mssql_connect() problem In-Reply-To: <20120220.221422.26068.0@webmail08.dca.untd.com> References: <20120220.221422.26068.0@webmail08.dca.untd.com> Message-ID: Paul, Is this still a problem? Are you running PHP on windows or on linux? If you are running it on windows, you should really use the Sql Server Driver for PHP http://www.microsoft.com/download/en/details.aspx?id=20098. If you are running PHP on ubuntu, the mssql driver is not available from the default repositories. I think you will have to build it yourself. Cheers, Justin On Mon, Feb 20, 2012 at 11:14 PM, tuon1 at netzero.net wrote: > I'm a novice in mssql world and just getting started to learn how to > program mssql in PHP. I'm having trouble getting PHP to execute my code > below. It seems that PHP doesn't recorgnize mssql_connect() as the error > message stated so. See the error message following the code. > > Can anyone tell me what's wrong with it? > > Thanks in advance. > > Paul > > $database="db40442xxx"; > $localhost="db40442xxx.db.example.com"; > $username="dbo40442xxx"; > $password="databasepass1"; > > /* Initialize and connect the database */ > $conn = mssql_connect($localhost, $username, $password); //Line 8 > if (!$conn) > { > die('Could not connect: ' . mssql_get_last_message()); > } > mssql_select_db($database, $conn) or die( "Unable to select database. " . > mssql_get_last_message()); > > ?> > > Here's the error message: > > > Fatal error: Call to undefined function mssql_connect() in > E:\kunden\homepages\5\d397017418\www\Example\Registration\CreateTable.php > on line 8 > > > ____________________________________________________________ > *Refinance for 2.125%/2.989% APR* > Loans under 729K usually qualify for US GOV backed refinance programs > > theeasyloansite.com > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rakics at gmail.com Fri Mar 9 13:09:05 2012 From: rakics at gmail.com (Sasa Rakic - Gmail) Date: Fri, 9 Mar 2012 19:09:05 +0100 Subject: [nycphp-talk] Testing subscription Message-ID: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> Test -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeff at jeffslutz.com Fri Mar 9 13:10:22 2012 From: jeff at jeffslutz.com (Jeff Slutz) Date: Fri, 9 Mar 2012 13:10:22 -0500 Subject: [nycphp-talk] Testing subscription In-Reply-To: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> References: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> Message-ID: I got your message. Welcome! JS -- Jeff Slutz JSLEUTH LLC 3242 44th ST APT 3F Astoria, NY 11103 c. 970.443.9390 jeff at jeffslutz.com On Fri, Mar 9, 2012 at 1:09 PM, Sasa Rakic - Gmail wrote: > Test**** > > ** ** > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cvasquez39 at gmail.com Sat Mar 10 12:54:16 2012 From: cvasquez39 at gmail.com (Charles Vasquez) Date: Sat, 10 Mar 2012 12:54:16 -0500 Subject: [nycphp-talk] Testing subscription In-Reply-To: References: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> Message-ID: Test On Fri, Mar 9, 2012 at 1:10 PM, Jeff Slutz wrote: > I got your message. Welcome! > > JS > -- > Jeff Slutz > JSLEUTH LLC > 3242 44th ST APT 3F > Astoria, NY 11103 > c. 970.443.9390 > jeff at jeffslutz.com > > > On Fri, Mar 9, 2012 at 1:09 PM, Sasa Rakic - Gmail wrote: > >> Test**** >> >> ** ** >> >> _______________________________________________ >> New York PHP User Group Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> http://www.nyphp.org/show-participation >> > > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rakics at gmail.com Sat Mar 10 15:44:05 2012 From: rakics at gmail.com (Sasa Rakic - Gmail) Date: Sat, 10 Mar 2012 21:44:05 +0100 Subject: [nycphp-talk] Testing subscription In-Reply-To: References: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> Message-ID: <01b401ccfefe$89bd13c0$9d373b40$@gmail.com> Hi there, My name is Sasa Rakic, I am newbie on this list. I am Senior Developer with more than 14 years? experience. More about me you can found on: http://www.achiles.net my Face Book page is: http://www.facebook.com/rakics My primary goal is to help Joomla community and learn through helping. I had crisis in my life, but when asked for Help it was told to me: You can show that Serbs are good only through your work (I lost best student from my generation When his vehicle was exposed more than 12 seconds, so I had some angry to myself). Also about money I got Advice: I have money to help you, but it is in bank so I cannot get that money. I am willing to give my feedback to Joomla community. I am good person only when I control what I am doing. Best regards, Sasa From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Charles Vasquez Sent: Saturday, March 10, 2012 6:54 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Testing subscription Test On Fri, Mar 9, 2012 at 1:10 PM, Jeff Slutz wrote: I got your message. Welcome! JS -- Jeff Slutz JSLEUTH LLC 3242 44th ST APT 3F Astoria, NY 11103 c. 970.443.9390 jeff at jeffslutz.com On Fri, Mar 9, 2012 at 1:09 PM, Sasa Rakic - Gmail wrote: Test _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation -------------- next part -------------- An HTML attachment was scrubbed... URL: From cvasquez39 at gmail.com Sat Mar 10 16:56:41 2012 From: cvasquez39 at gmail.com (Charles Vasquez) Date: Sat, 10 Mar 2012 16:56:41 -0500 Subject: [nycphp-talk] Testing subscription In-Reply-To: <01b401ccfefe$89bd13c0$9d373b40$@gmail.com> References: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> <01b401ccfefe$89bd13c0$9d373b40$@gmail.com> Message-ID: what?! I don't understand. Student in an exposed vehicle? Money in the bank? What programing language are you smoking! On Sat, Mar 10, 2012 at 3:44 PM, Sasa Rakic - Gmail wrote: > Hi there,**** > > ** ** > > My name is Sasa Rakic, I am newbie on this list. I am Senior Developer > with more than 14 years? experience.**** > > More about me you can found on:**** > > ** ** > > http://www.achiles.net**** > > ** ** > > my Face Book page is:**** > > ** ** > > http://www.facebook.com/rakics**** > > ** ** > > My primary goal is to help Joomla community and learn through helping. I > had crisis in my life, but when asked for**** > > Help it was told to me: You can show that Serbs are good only through your > work (I lost best student from my generation**** > > When his vehicle was exposed more than 12 seconds, so I had some angry to > myself). Also about money I got**** > > Advice: I have money to help you, but it is in bank so I cannot get that > money.**** > > ** ** > > I am willing to give my feedback to Joomla community. I am good person > only when I control what I am doing.**** > > ** ** > > Best regards,**** > > Sasa**** > > ** ** > > *From:* talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] > *On Behalf Of *Charles Vasquez > *Sent:* Saturday, March 10, 2012 6:54 PM > *To:* NYPHP Talk > *Subject:* Re: [nycphp-talk] Testing subscription**** > > ** ** > > Test**** > > On Fri, Mar 9, 2012 at 1:10 PM, Jeff Slutz wrote:**** > > I got your message. Welcome! > > JS > -- > Jeff Slutz > JSLEUTH LLC > 3242 44th ST APT 3F > Astoria, NY 11103 > c. 970.443.9390 > jeff at jeffslutz.com > > **** > > On Fri, Mar 9, 2012 at 1:09 PM, Sasa Rakic - Gmail > wrote:**** > > Test**** > > **** > > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation**** > > > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation**** > > ** ** > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rakics at gmail.com Sat Mar 10 17:24:34 2012 From: rakics at gmail.com (Sasa Rakic - Gmail) Date: Sat, 10 Mar 2012 23:24:34 +0100 Subject: [nycphp-talk] Testing subscription In-Reply-To: References: <002901ccfe1f$b77e22c0$267a6840$@gmail.com> <01b401ccfefe$89bd13c0$9d373b40$@gmail.com> Message-ID: <01da01ccff0c$933de7e0$b9b9b7a0$@gmail.com> >what?! I don't understand. Student in an exposed vehicle? Money in the bank? What programing language are you smoking! Several of friends in my middle school was smoking, it was normal for them, 33% of young peoples in city where I had leave was smoking as we were harbor city and everything comes over the city, as son of policeman I did not have thinking in that direction. On Sat, Mar 10, 2012 at 3:44 PM, Sasa Rakic - Gmail wrote: Hi there, My name is Sasa Rakic, I am newbie on this list. I am Senior Developer with more than 14 years? experience. More about me you can found on: http://www.achiles.net my Face Book page is: http://www.facebook.com/rakics My primary goal is to help Joomla community and learn through helping. I had crisis in my life, but when asked for Help it was told to me: You can show that Serbs are good only through your work (I lost best student from my generation When his vehicle was exposed more than 12 seconds, so I had some angry to myself). Also about money I got Advice: I have money to help you, but it is in bank so I cannot get that money. I am willing to give my feedback to Joomla community. I am good person only when I control what I am doing. Best regards, Sasa From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Charles Vasquez Sent: Saturday, March 10, 2012 6:54 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Testing subscription Test On Fri, Mar 9, 2012 at 1:10 PM, Jeff Slutz wrote: I got your message. Welcome! JS -- Jeff Slutz JSLEUTH LLC 3242 44th ST APT 3F Astoria, NY 11103 c. 970.443.9390 jeff at jeffslutz.com On Fri, Mar 9, 2012 at 1:09 PM, Sasa Rakic - Gmail wrote: Test _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation -------------- next part -------------- An HTML attachment was scrubbed... URL: From plehrer at gmail.com Fri Mar 16 09:11:55 2012 From: plehrer at gmail.com (Peter Lehrer) Date: Fri, 16 Mar 2012 09:11:55 -0400 Subject: [nycphp-talk] can't get php to work Message-ID: Hi, I am trying to get the php mail function to work. I have a website running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to get a test email message working. Here is my code: Can anybody help me? Regards,. Peter Lehrer From david at davidmintz.org Fri Mar 16 11:29:30 2012 From: david at davidmintz.org (David Mintz) Date: Fri, 16 Mar 2012 11:29:30 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: > Hi, > I am trying to get the php mail function to work. I have a website > running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to > get a test email message working. Here is my code: > > $to = "plehrer at gmail.com"; > $subject = "Test mail"; > $message = "Hello! This is a simple email message."; > $from = "plehrer at me.outlook.com"; > $headers = "From:" . $from; > mail($to,$subject,$message,$headers); > echo "Mail Sent."; > ?> > > What platform are you on? What do the relevant php.ini settings look like? http://www.php.net/manual/en/mail.configuration.php -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidmintz.org Fri Mar 16 11:30:45 2012 From: david at davidmintz.org (David Mintz) Date: Fri, 16 Mar 2012 11:30:45 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: On Fri, Mar 16, 2012 at 11:29 AM, David Mintz wrote: > > > On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: > >> Hi, >> I am trying to get the php mail function to work. I have a website >> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to >> get a test email message working. Here is my code: >> >> > $to = "plehrer at gmail.com"; >> $subject = "Test mail"; >> $message = "Hello! This is a simple email message."; >> $from = "plehrer at me.outlook.com"; >> $headers = "From:" . $from; >> mail($to,$subject,$message,$headers); >> echo "Mail Sent."; >> ?> >> >> > What platform are you on? > My apologies. You said Debian. -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From plehrer at gmail.com Fri Mar 16 11:41:16 2012 From: plehrer at gmail.com (Peter Lehrer) Date: Fri, 16 Mar 2012 11:41:16 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: I think my problem is I don't have sendmail installed. Peter On Fri, Mar 16, 2012 at 11:29 AM, David Mintz wrote: > > > On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: >> >> Hi, >> I am trying to get the php mail function to work. I have a website >> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to >> get a test email message working. Here is my code: >> >> > $to = "plehrer at gmail.com"; >> $subject = "Test mail"; >> $message = "Hello! This is a simple email message."; >> $from = "plehrer at me.outlook.com"; >> $headers = "From:" . $from; >> mail($to,$subject,$message,$headers); >> echo "Mail Sent."; >> ?> >> > > What platform are you on? What do the relevant php.ini settings look like? > > http://www.php.net/manual/en/mail.configuration.php > > -- > David Mintz > http://davidmintz.org/ > It ain't over: > http://www.healthcare-now.org/ > > > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation From chsnyder at gmail.com Fri Mar 16 11:42:40 2012 From: chsnyder at gmail.com (Chris Snyder) Date: Fri, 16 Mar 2012 11:42:40 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: > Hi, > I am trying to get the php mail function to work. I have a website > running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to > get a test email message working. Here is my code: > > $to = "plehrer at gmail.com"; > $subject = "Test mail"; > $message = "Hello! This is a simple email message."; > $from = "plehrer at me.outlook.com"; > $headers = "From:" . $from; > mail($to,$subject,$message,$headers); > echo "Mail Sent."; > ?> > > Can anybody help me? > Best way to debug mailing issues is to view the mail log and see if there are any clues as to what went wrong. On Debian, it is at /var/log/mail.log Very often mail problems have to do with anti-spam controls in receiving systems. Most big email companies will only accept mail from servers with a reverse-DNS record that maps the IP address to a real name. Also, you may be running up against SPF records created by outlook.com that prevent forging mail from that address. One thing I notice in your script is a missing space after the colon in "From:". From appel at alsjeblaft.nl Fri Mar 16 11:46:50 2012 From: appel at alsjeblaft.nl (Ap | Alsjeblaft!) Date: Fri, 16 Mar 2012 16:46:50 +0100 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: Perhaps this article is useful: http://www.davidhurst.co.uk/2007/06/19/php-mail-and-ssmtp-on-debian-linux/ -- *Alsjeblaft!* webdevelopment Stuff I've built: wende.nu, sizzer.nl, happycampermusic.com, dazzledkid.com , arthurjussen.nl, schradinova.nl, roomeleven.nl & studiopino.nl appel at alsjeblaft.nl http://www.alsjeblaft.nl/ On Fri, Mar 16, 2012 at 4:41 PM, Peter Lehrer wrote: > I think my problem is I don't have sendmail installed. > > Peter > > On Fri, Mar 16, 2012 at 11:29 AM, David Mintz > wrote: > > > > > > On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: > >> > >> Hi, > >> I am trying to get the php mail function to work. I have a website > >> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to > >> get a test email message working. Here is my code: > >> > >> >> $to = "plehrer at gmail.com"; > >> $subject = "Test mail"; > >> $message = "Hello! This is a simple email message."; > >> $from = "plehrer at me.outlook.com"; > >> $headers = "From:" . $from; > >> mail($to,$subject,$message,$headers); > >> echo "Mail Sent."; > >> ?> > >> > > > > What platform are you on? What do the relevant php.ini settings look > like? > > > > http://www.php.net/manual/en/mail.configuration.php > > > > -- > > David Mintz > > http://davidmintz.org/ > > It ain't over: > > http://www.healthcare-now.org/ > > > > > > > > _______________________________________________ > > New York PHP User Group Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > http://www.nyphp.org/show-participation > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rainelemental at gmail.com Fri Mar 16 11:47:48 2012 From: rainelemental at gmail.com (Federico Ulfo) Date: Fri, 16 Mar 2012 11:47:48 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: Exactly. It's easy: http://www.linuxserverhowto.com/linux-mail-server-sendmail/install-sendmail-using-apt-get.html As alternative you can use dedicated SMTP servers, which often are more reliable than shared hosting server, although way slower. On Fri, Mar 16, 2012 at 11:41 AM, Peter Lehrer wrote: > I think my problem is I don't have sendmail installed. > > Peter > > On Fri, Mar 16, 2012 at 11:29 AM, David Mintz > wrote: > > > > > > On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: > >> > >> Hi, > >> I am trying to get the php mail function to work. I have a website > >> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to > >> get a test email message working. Here is my code: > >> > >> >> $to = "plehrer at gmail.com"; > >> $subject = "Test mail"; > >> $message = "Hello! This is a simple email message."; > >> $from = "plehrer at me.outlook.com"; > >> $headers = "From:" . $from; > >> mail($to,$subject,$message,$headers); > >> echo "Mail Sent."; > >> ?> > >> > > > > What platform are you on? What do the relevant php.ini settings look > like? > > > > http://www.php.net/manual/en/mail.configuration.php > > > > -- > > David Mintz > > http://davidmintz.org/ > > It ain't over: > > http://www.healthcare-now.org/ > > > > > > > > _______________________________________________ > > New York PHP User Group Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > http://www.nyphp.org/show-participation > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From plehrer at gmail.com Fri Mar 16 11:49:56 2012 From: plehrer at gmail.com (Peter Lehrer) Date: Fri, 16 Mar 2012 11:49:56 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: OK, Thanks. I installed sendmail on my local machine and got it to work. However, when I send it to my gmail account, it goes into spam. This is probably due to the reason Chris enumerated. Peter On Fri, Mar 16, 2012 at 11:42 AM, Chris Snyder wrote: > On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: >> Hi, >> I am trying to get the php mail function to work. I have a website >> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to >> get a test email message working. Here is my code: >> >> > $to = "plehrer at gmail.com"; >> $subject = "Test mail"; >> $message = "Hello! This is a simple email message."; >> $from = "plehrer at me.outlook.com"; >> $headers = "From:" . $from; >> mail($to,$subject,$message,$headers); >> echo "Mail Sent."; >> ?> >> >> Can anybody help me? >> > > Best way to debug mailing issues is to view the mail log and see if > there are any clues as to what went wrong. On Debian, it is at > /var/log/mail.log > > Very often mail problems have to do with anti-spam controls in > receiving systems. Most big email companies will only accept mail from > servers with a reverse-DNS record that maps the IP address to a real > name. Also, you may be running up against SPF records created by > outlook.com that prevent forging mail from that address. > > One thing I notice in your script is a missing space after the colon in "From:". > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation From rainelemental at gmail.com Fri Mar 16 12:02:22 2012 From: rainelemental at gmail.com (Federico Ulfo) Date: Fri, 16 Mar 2012 12:02:22 -0400 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: Yup, also shared hosting often are hacked used to send mass email, and obviously black listed, so it depends by the security level of the receiver of the email if the email go into inbox or spam! I did a few mass mail using SMTP, they are slow, like one email every 1-3 seconds, and PHP wait for the email to be sent, so to avoid users waiting for the email sending, you want to setup a mail pipeline and a chron job, or, using some trick like opening the script the send the email into an iframe. On Fri, Mar 16, 2012 at 11:49 AM, Peter Lehrer wrote: > OK, Thanks. I installed sendmail on my local machine and got it to > work. However, when I send it to my gmail account, it goes into spam. > This is probably due to the reason Chris enumerated. > > Peter > > On Fri, Mar 16, 2012 at 11:42 AM, Chris Snyder wrote: > > On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: > >> Hi, > >> I am trying to get the php mail function to work. I have a website > >> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to > >> get a test email message working. Here is my code: > >> > >> >> $to = "plehrer at gmail.com"; > >> $subject = "Test mail"; > >> $message = "Hello! This is a simple email message."; > >> $from = "plehrer at me.outlook.com"; > >> $headers = "From:" . $from; > >> mail($to,$subject,$message,$headers); > >> echo "Mail Sent."; > >> ?> > >> > >> Can anybody help me? > >> > > > > Best way to debug mailing issues is to view the mail log and see if > > there are any clues as to what went wrong. On Debian, it is at > > /var/log/mail.log > > > > Very often mail problems have to do with anti-spam controls in > > receiving systems. Most big email companies will only accept mail from > > servers with a reverse-DNS record that maps the IP address to a real > > name. Also, you may be running up against SPF records created by > > outlook.com that prevent forging mail from that address. > > > > One thing I notice in your script is a missing space after the colon in > "From:". > > _______________________________________________ > > New York PHP User Group Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > http://www.nyphp.org/show-participation > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin at justinhileman.info Fri Mar 16 13:17:13 2012 From: justin at justinhileman.info (justin) Date: Fri, 16 Mar 2012 10:17:13 -0700 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: I usually use SendGrid (or something similar). Mail/spam/blacklist/etc just isn't worth dealing with :) --j On Fri, Mar 16, 2012 at 8:49 AM, Peter Lehrer wrote: > OK, Thanks. I installed sendmail on my local machine and got it to > work. However, when I send it to my gmail account, it goes into spam. > This is probably due to the reason Chris enumerated. > > Peter > > On Fri, Mar 16, 2012 at 11:42 AM, Chris Snyder wrote: >> On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: >>> Hi, >>> I am trying to get the php mail function to work. I have a website >>> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried to >>> get a test email message working. Here is my code: >>> >>> >> $to = "plehrer at gmail.com"; >>> $subject = "Test mail"; >>> $message = "Hello! This is a simple email message."; >>> $from = "plehrer at me.outlook.com"; >>> $headers = "From:" . $from; >>> mail($to,$subject,$message,$headers); >>> echo "Mail Sent."; >>> ?> >>> >>> Can anybody help me? >>> >> >> Best way to debug mailing issues is to view the mail log and see if >> there are any clues as to what went wrong. On Debian, it is at >> /var/log/mail.log >> >> Very often mail problems have to do with anti-spam controls in >> receiving systems. Most big email companies will only accept mail from >> servers with a reverse-DNS record that maps the IP address to a real >> name. Also, you may be running up against SPF records created by >> outlook.com that prevent forging mail from that address. >> >> One thing I notice in your script is a missing space after the colon in "From:". >> _______________________________________________ >> New York PHP User Group Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> http://www.nyphp.org/show-participation > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation -- http://justinhileman.com From rakics at gmail.com Fri Mar 16 14:13:12 2012 From: rakics at gmail.com (Sasa Rakic - Gmail) Date: Fri, 16 Mar 2012 19:13:12 +0100 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: <015001cd03a0$739f8fe0$5adeafa0$@gmail.com> I am using this code for HTML mail send: "; $mailSenderReplyTo = "Sitename Team <" . "test at test.com" . ">"; if ($isDevMachine) { $mailRecepientTo = "dev at test.com"; $mailRecepientCc = ""; $mailRecepientBcc = ""; $mailSenderFrom = ""; $mailSenderReplyTo = ""; } ob_start(); require_once("contact.mail.html"); $mailBody = ob_get_contents(); ob_end_clean(); mail($mailRecepientTo, "New Contact Us submission", $mailBody, ($mailRecepientCc == "" ? "" : "Cc: " . $mailRecepientCc . "\n") . ($mailRecepientBcc == "" ? "" : "Bcc: " . $mailRecepientBcc . "\n") . ($mailSenderFrom == "" ? "" : "From: " . $mailSenderFrom . "\n") . ($mailSenderReplyTo == "" ? "" : "Reply-To: " . $mailSenderReplyTo . "\n") . "X-Mailer: PHP/" . phpversion() . "\n" . "MIME-version: 1.0\n" . "Content-type: text/html; charset=us-ascii\n" . "Content-Transfer-Encoding: 8bit\n\n"); ?> -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of justin Sent: Friday, March 16, 2012 6:17 PM To: NYPHP Talk Subject: Re: [nycphp-talk] can't get php to work I usually use SendGrid (or something similar). Mail/spam/blacklist/etc just isn't worth dealing with :) --j On Fri, Mar 16, 2012 at 8:49 AM, Peter Lehrer wrote: > OK, Thanks. I installed sendmail on my local machine and got it to > work. However, when I send it to my gmail account, it goes into spam. > This is probably due to the reason Chris enumerated. > > Peter > > On Fri, Mar 16, 2012 at 11:42 AM, Chris Snyder wrote: >> On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: >>> Hi, >>> I am trying to get the php mail function to work. I have a website >>> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried >>> to get a test email message working. Here is my code: >>> >>> >> $to = "plehrer at gmail.com"; >>> $subject = "Test mail"; >>> $message = "Hello! This is a simple email message."; $from = >>> "plehrer at me.outlook.com"; $headers = "From:" . $from; >>> mail($to,$subject,$message,$headers); >>> echo "Mail Sent."; >>> ?> >>> >>> Can anybody help me? >>> >> >> Best way to debug mailing issues is to view the mail log and see if >> there are any clues as to what went wrong. On Debian, it is at >> /var/log/mail.log >> >> Very often mail problems have to do with anti-spam controls in >> receiving systems. Most big email companies will only accept mail >> from servers with a reverse-DNS record that maps the IP address to a >> real name. Also, you may be running up against SPF records created by >> outlook.com that prevent forging mail from that address. >> >> One thing I notice in your script is a missing space after the colon in "From:". >> _______________________________________________ >> New York PHP User Group Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> http://www.nyphp.org/show-participation > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation -- http://justinhileman.com _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation From rakics at gmail.com Fri Mar 16 14:14:43 2012 From: rakics at gmail.com (Sasa Rakic - Gmail) Date: Fri, 16 Mar 2012 19:14:43 +0100 Subject: [nycphp-talk] can't get php to work In-Reply-To: References: Message-ID: <015101cd03a0$aa0b4b50$fe21e1f0$@gmail.com> If you need SMTP mail example I can send it. -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of justin Sent: Friday, March 16, 2012 6:17 PM To: NYPHP Talk Subject: Re: [nycphp-talk] can't get php to work I usually use SendGrid (or something similar). Mail/spam/blacklist/etc just isn't worth dealing with :) --j On Fri, Mar 16, 2012 at 8:49 AM, Peter Lehrer wrote: > OK, Thanks. I installed sendmail on my local machine and got it to > work. However, when I send it to my gmail account, it goes into spam. > This is probably due to the reason Chris enumerated. > > Peter > > On Fri, Mar 16, 2012 at 11:42 AM, Chris Snyder wrote: >> On Fri, Mar 16, 2012 at 9:11 AM, Peter Lehrer wrote: >>> Hi, >>> I am trying to get the php mail function to work. I have a website >>> running Apache2 and PHP Version 5.3.3-7+squeeze8 on Debian. I tried >>> to get a test email message working. Here is my code: >>> >>> >> $to = "plehrer at gmail.com"; >>> $subject = "Test mail"; >>> $message = "Hello! This is a simple email message."; $from = >>> "plehrer at me.outlook.com"; $headers = "From:" . $from; >>> mail($to,$subject,$message,$headers); >>> echo "Mail Sent."; >>> ?> >>> >>> Can anybody help me? >>> >> >> Best way to debug mailing issues is to view the mail log and see if >> there are any clues as to what went wrong. On Debian, it is at >> /var/log/mail.log >> >> Very often mail problems have to do with anti-spam controls in >> receiving systems. Most big email companies will only accept mail >> from servers with a reverse-DNS record that maps the IP address to a >> real name. Also, you may be running up against SPF records created by >> outlook.com that prevent forging mail from that address. >> >> One thing I notice in your script is a missing space after the colon in "From:". >> _______________________________________________ >> New York PHP User Group Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> http://www.nyphp.org/show-participation > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation -- http://justinhileman.com _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation From garyamort at gmail.com Mon Mar 19 11:38:05 2012 From: garyamort at gmail.com (Gary Mort) Date: Mon, 19 Mar 2012 11:38:05 -0400 Subject: [nycphp-talk] Are Singletons Really Evil? Message-ID: <4F6752DD.3020601@gmail.com> Yay... Spring is here, blood starts flowing, mind starts stuttering. So I figured I'd ask others opinions on if singleton's really are "evil". It seems to me that "singletons are evil" is part of the a classic programmer pattern: a lot of programmers get burned by something, they declare it evil and propose something 'new'[I beleive the evolution is towards 'dependency injection'], and a new paradigm takes control for a while.. The issue I see though is that in the end, all that is really being done is a new methodology is being created to solve two age old issues: globals and configuration information. At the end of the day, it's not the method that is in itself "evil", but rather the lack of unified programming discipline and initial failures discovered. Back when I started programming[30 years ago] and as I progressed, 'object oriented' code wasn't a system and everyone used globals. Venerable good coding practices were to document your functions - to specify what these functions required, what global variables they might need, what variables they set, etc. Yet time after time, coders do not follow this practice. They do not document these things. And so we get "globals are evil"...instead of "programmers are lazy"... This leads to new methodology's..and these new methods "work" for a while, not because they are great, but because they are "new" so everyone follows the same rules. And then over time, "programmers are lazy" and these new systems fall down. At which point a "new, better" system is made. And of course, over time problems are encountered, and another "new system" is created. In the end, we have a bunch of competing methodologies and the strongest argument for any one of them is that the others are "evil"...or more precisely, the programmer making the argument has gotten burned and doesn't want to be burned again. So that bring us to "why are singleton's evil?"...and the only reason I see come up over and over is "dependency injection".. but when I view examples of dependency injection "failure" I find that the failure is a failure of implementation, not a failure in the concept of Singleton's. The classic example of singleton failure goes something like this: Given a singleton object[say a database object: $db = MyDBClass::getInstance();] you are 'stuck' with a single database connection. If you want to have multiple database connections[say for an order database and a data warehouse - you can't simply call $db = MyDBClass:getInstance(); and $dw = MyDBCLass::getInstance(); and magically get 2 different database connections. Even worse is that you can't 'unit test' classes which use the database object because you can't have a test/mock database object. Now, this may well have been true for PHP when people first started using singleton's. But today there are at least 3 ways, without using dependency injection, that I can think of off the top of my head to solve this problem. For unit testing: ---- class MockDB extends DB { // implement DB functions as mock functions } // create the testing database $testDB = new MockDB(); // use the reflection class to change the instance $changeDB = new ReflectionClass('DB'); $changeDB->setStatisPropertyValue('instance',$changeDB); ---- To override the instance in live code, one could also use the reflection class - or one can create a subclass just to change the instance: Class datawarehouseDB extends DB { public static getInstance() { if (get_class(self::$instance) != *|__CLASS__) { $datawarehouseDB = new datawarehouseDB(); self::$instance = $datawarehouseDB; |* } return parent::getInstance(); } } The above code will make sure that the current default db instance is a datawarehouseDB object. You can also change your getInstance code to allow passing in an override: public static getInstance($instance = null, $force = false) { // only allow overriding instance if the instance class is ourself or one of children if (is_a($instance, __CLASS__*|) { // as added protection, use a force flag so that if the instance // has already been set, the new code must explicitly FORCE override // ie: make the coder think about what they are doing if ((self::$instance === null) || ($force === true)) { self:$instance = $instance; |* } } // now back to our traditional getInstance code if (self::$instance == null) { self::$instance = new DB(); } return self::$instance; } I've also seen from time to time where instance can also be used to refer to an array of instances. IE public static getInstance($keyword = 'default') { // now back to our traditional getInstance code if (!(isset(self::$instances[$keyword]))) { self::$instances[$keyword] = new DB(); } return self::$instances[$keyword]; } } Now, my point with the above is not to say this is "the way" one should do things - it is just to point out that with the state of PHP 5.3 today, many of the "singleton's are evil" arguments no longer hold water. As such, when you inherit a codebase using singleton's which is having all these traditional problems[unit testing, the need for multiple objects at times, etc] - I don't see any reason to rush to replace all the existing calls to getInstance with some new methodology. Instead you can use the ReflectionClass or any one of a number of different changes in order to setup unit tests without making lengthy, invasive code changes. At the end of the day, I can't think of any decently sized application which will not at some point need to store/retrieve configuration data from somewhere and have objects which inter-operate with each other. The main thing to keep in mind is not the '_____ method is evil' - but rather to be consistent in using some methodology. So my question is....what is it I'm missing? What massively obvious reason is there that makes Singleton's "evil"? Or is it just part of the 30+ year pattern in programming I've noticed that "newer is better" where there is reason for change "in general" - but that instead it depends on the situation/case what the best solution is? -Gary -------------- next part -------------- An HTML attachment was scrubbed... URL: From ant92083 at gmail.com Mon Mar 19 11:54:40 2012 From: ant92083 at gmail.com (Anthony W.) Date: Mon, 19 Mar 2012 11:54:40 -0400 Subject: [nycphp-talk] Are Singletons Really Evil? In-Reply-To: <4F6752DD.3020601@gmail.com> References: <4F6752DD.3020601@gmail.com> Message-ID: <4F6756C0.9030506@gmail.com> I think the "evil" association comes from exactly what you said, people getting burned. However I feel that singleton's do have use. For example a log file, you only really need one instance for example. However there are a couple of reasons why I would argue against implementing a singleton: 1.) resource usage for the life of the application 2.) thread issues (not really an issue in PHP) 3.) is this the only way, how about exposure via an interface? Here are reasons why I argue for implementing a singleton: 1.) they describe a unique resource of the application 2.) global data is sometimes necessary 3.) limit abuse of finite system resources I could go on all day about this but I would like to hear other arguments. -- Anthony W. ant92083 at gmail.com From david at davidmintz.org Mon Mar 19 12:15:06 2012 From: david at davidmintz.org (David Mintz) Date: Mon, 19 Mar 2012 12:15:06 -0400 Subject: [nycphp-talk] Are Singletons Really Evil? In-Reply-To: <4F6756C0.9030506@gmail.com> References: <4F6752DD.3020601@gmail.com> <4F6756C0.9030506@gmail.com> Message-ID: Speaking as less advanced developer than most of you, in my genuinely humble opinion: I hope this isn't off-topic, but I've been working with Zend Framework 1 since it was in diapers. It had a learning curve and seemed a bit heavy but I felt it was worth it in my situation. Now comes ZF2, and as I start reading and learning about it, I can't help but wonder if I really need Dependency Injection. I hadn't noticed that I was having any problem managing my dependencies, thanks. There has been one case in my project where different classes needed access to a model instance, and I scratched my head for a while before deciding to use a singleton. This is the first I've heard that the pattern is considered evil by anyone. As I look at the ZF2 documentation, I'm like, wait a second. Is this not really, really complicated? Worse, perhaps, than the disease it's intended to cure? -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rainelemental at gmail.com Mon Mar 19 12:39:07 2012 From: rainelemental at gmail.com (federico ulfo) Date: Mon, 19 Mar 2012 12:39:07 -0400 Subject: [nycphp-talk] Are Singletons Really Evil? In-Reply-To: References: <4F6752DD.3020601@gmail.com> <4F6756C0.9030506@gmail.com> Message-ID: <-4555293909550841614@unknownmsgid> Well, I've been using singleton for years, they do what they're supposed to do, make a class object "global", so that you save memory and make the call faster. Singleton/Multiton are not the best solution to make unit testable code and extendible. Dependency Injection dolce this problem, also creatina a standard container class ZF2 and Symfony, are creating a sorta of plugin interface, so that you can easily interchange the classes between the 2 framework. They're thought to standardize the coding to improve the team work. About performance, they're obviously slower, I spoke with Fabien Potencier and he's convinced about improving performance at the application layer with Varnish, Amazon etc., which I agree partially, because that is the right way for big project, definitely not for small one, like a CMS for everyone! So consider to keep using Singleton/Multiton and even Static Class when you need to! Sent from my iPhone On Mar 19, 2012, at 12:15 PM, David Mintz wrote: Speaking as less advanced developer than most of you, in my genuinely humble opinion: I hope this isn't off-topic, but I've been working with Zend Framework 1 since it was in diapers. It had a learning curve and seemed a bit heavy but I felt it was worth it in my situation. Now comes ZF2, and as I start reading and learning about it, I can't help but wonder if I really need Dependency Injection. I hadn't noticed that I was having any problem managing my dependencies, thanks. There has been one case in my project where different classes needed access to a model instance, and I scratched my head for a while before deciding to use a singleton. This is the first I've heard that the pattern is considered evil by anyone. As I look at the ZF2 documentation, I'm like, wait a second. Is this not really, really complicated? Worse, perhaps, than the disease it's intended to cure? -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation -------------- next part -------------- An HTML attachment was scrubbed... URL: From danielc at analysisandsolutions.com Sun Mar 25 16:07:55 2012 From: danielc at analysisandsolutions.com (Daniel Convissor) Date: Sun, 25 Mar 2012 16:07:55 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: Message-ID: <20120325200755.GA12577@panix.com> Hi David: > My Dreamhost shared hosting account just had its *.php injected with some > garbage. Sorry. Alas, injecting code into legitimate sites is the #1 source these days of infecting end user computers. So securing our rinky-dink personal websites has become quite important. I recently picked WordPress for a site and then looked for security plugins for it. The eventually lead me to write my own plugin, which somehow wound up taking about six weeks of intense work. I've passed it around for testing and code review. I'd love to hear the thoughts of the people here on it from a code level and user interface level. http://wordpress.org/extend/plugins/login-security-solution/ > egrep -lr '<\?php.+eval\(base64_decode\("[^"]+"\)\);\?>' *| xargs I'd have just grep'ed for "eval", since that should never be in any code I want to use. Your regex would miss code that doesn't have double quotes, doesn't use base64_decode, has spacing in it, etc. Oh, and lock down your file permissions. The web server shouldn't be allowed to write to any files or directories. Thanks, --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 From david at davidmintz.org Tue Mar 27 10:47:16 2012 From: david at davidmintz.org (David Mintz) Date: Tue, 27 Mar 2012 10:47:16 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: <20120325200755.GA12577@panix.com> References: <20120325200755.GA12577@panix.com> Message-ID: On Sun, Mar 25, 2012 at 4:07 PM, Daniel Convissor < danielc at analysisandsolutions.com> wrote: > 'd love to hear the thoughts of > the people here on it from a code level and user interface level. > > http://wordpress.org/extend/plugins/login-security-solution/ > > Dan, I haven't tried it yet but from reading about the features, OMG! It's great. I will install it. > > > egrep -lr '<\?php.+eval\(base64_decode\("[^"]+"\)\);\?>' *| xargs > > I'd have just grep'ed for "eval", since that should never be in any code > I want to use. Your regex would miss code that doesn't have double > quotes, doesn't use base64_decode, has spacing in it, etc. > Yeah, I assembled the regex based specifically on the malicious code that I was looking at in all my files. I suppose the trick is to fashion a regex that catches an actual eval call inside php tags -- there's always a chance that the string "eval" is is somehow legitimately contained inside some php tags. > Oh, and lock down your file permissions. The web server shouldn't be > allowed to write to any files or directories. > > Except when it really needs to, like for writing data to a file-based cache, or accepting file uploads. How do you recommend handling those cases? I have been wondering, why not chmod ALL your php files to 400? Indeed I did this with one site after my infection, but not the several others. Then I got hit again, but the site whose php files were 400 was not affected -- probably not a coincidence. It's perhaps a bit of an inconvenience when you need to update/overwrite, but I see no reason we can't relax permissions temporarily for code deployments and reset them back when we're done. -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsnyder at gmail.com Tue Mar 27 10:56:15 2012 From: chsnyder at gmail.com (Chris Snyder) Date: Tue, 27 Mar 2012 10:56:15 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: >> Oh, and lock down your file permissions. ?The web server shouldn't be >> allowed to write to any files or directories. >> > > Except when it really needs to, like for writing data to a file-based cache, > or accepting file uploads. How do you recommend handling those cases? On a shared host? Don't use files for those things, use your database instead. For cache you can use SQLite if you really feel like staying in the filesystem. For uploaded files, store them in a table in MySQL. As a bonus, this makes backups easier. All you have to do is back up the database and you're done. From mkfmncom at gmail.com Tue Mar 27 11:20:54 2012 From: mkfmncom at gmail.com (Matthew Kaufman) Date: Tue, 27 Mar 2012 11:20:54 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: Apache's mod_websecurity and Snort will help... On Tuesday, March 27, 2012, Chris Snyder wrote: >>> Oh, and lock down your file permissions. The web server shouldn't be >>> allowed to write to any files or directories. >>> >> >> Except when it really needs to, like for writing data to a file-based cache, >> or accepting file uploads. How do you recommend handling those cases? > > On a shared host? Don't use files for those things, use your database instead. > > For cache you can use SQLite if you really feel like staying in the > filesystem. For uploaded files, store them in a table in MySQL. > > As a bonus, this makes backups easier. All you have to do is back up > the database and you're done. > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidmintz.org Tue Mar 27 12:16:01 2012 From: david at davidmintz.org (David Mintz) Date: Tue, 27 Mar 2012 12:16:01 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: On Tue, Mar 27, 2012 at 11:20 AM, Matthew Kaufman wrote: > Apache's mod_websecurity and Snort will help... > > > Thanks to all. Maybe also I should consider leaving shared hosting altogether, and moving to Rackspace or similar. It looks like prices have come way down. -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mkfmncom at gmail.com Tue Mar 27 12:19:10 2012 From: mkfmncom at gmail.com (Matthew Kaufman) Date: Tue, 27 Mar 2012 12:19:10 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: If you use RackSpace, I encourage NOT to use their cloud service. I was billed over 4 grand in one month for minimal and hard to track usage by the 'hour'. I hate to say this but I'd recommend Linode over RackSoace if you want a VPS. On Tuesday, March 27, 2012, David Mintz wrote: > > > On Tue, Mar 27, 2012 at 11:20 AM, Matthew Kaufman wrote: >> >> Apache's mod_websecurity and Snort will help... >> > > Thanks to all. Maybe also I should consider leaving shared hosting altogether, and moving to Rackspace or similar. It looks like prices have come way down. > -- > David Mintz > http://davidmintz.org/ > It ain't over: > http://www.healthcare-now.org/ > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsnyder at gmail.com Tue Mar 27 12:20:03 2012 From: chsnyder at gmail.com (Chris Snyder) Date: Tue, 27 Mar 2012 12:20:03 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: On Tue, Mar 27, 2012 at 12:16 PM, David Mintz wrote: > Thanks to all. Maybe also I should consider leaving shared hosting > altogether, and moving to Rackspace or similar. It looks like prices have > come way down. > DevOps for the win! On Amazon you can run an EC2 micro instance 24x7 for free. Probably as much oomph there as on your current shared host. From mkfmncom at gmail.com Tue Mar 27 12:21:45 2012 From: mkfmncom at gmail.com (Matthew Kaufman) Date: Tue, 27 Mar 2012 12:21:45 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: You can? With root access? On Tuesday, March 27, 2012, Chris Snyder wrote: > On Tue, Mar 27, 2012 at 12:16 PM, David Mintz wrote: > >> Thanks to all. Maybe also I should consider leaving shared hosting >> altogether, and moving to Rackspace or similar. It looks like prices have >> come way down. >> > > DevOps for the win! > > On Amazon you can run an EC2 micro instance 24x7 for free. Probably > as much oomph there as on your current shared host. > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsnyder at gmail.com Tue Mar 27 12:23:49 2012 From: chsnyder at gmail.com (Chris Snyder) Date: Tue, 27 Mar 2012 12:23:49 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: On Tue, Mar 27, 2012 at 12:21 PM, Matthew Kaufman wrote: > You can? ?With root access? Of course. Tasty cloud kool-aid. http://aws.amazon.com/free/ From hans at cyberxdesigns.com Tue Mar 27 12:24:05 2012 From: hans at cyberxdesigns.com (Hans C. Kaspersetz) Date: Tue, 27 Mar 2012 12:24:05 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: <23739793-FBA3-431B-9B69-6F64CF8166A6@cyberxdesigns.com> On Mar 27, 2012, at 12:19 PM, Matthew Kaufman wrote: > If you use RackSpace, I encourage NOT to use their cloud service. I was billed over 4 grand in one month for minimal and hard to track usage by the 'hour'. > > I hate to say this but I'd recommend Linode over RackSoace if you want a VPS. > SoftLayer cloud offers fixed monthly pricing and works well. Hans Kaspersetz Cyber X Designs From mkfmncom at gmail.com Tue Mar 27 12:30:24 2012 From: mkfmncom at gmail.com (Matthew Kaufman) Date: Tue, 27 Mar 2012 12:30:24 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: <23739793-FBA3-431B-9B69-6F64CF8166A6@cyberxdesigns.com> References: <20120325200755.GA12577@panix.com> <23739793-FBA3-431B-9B69-6F64CF8166A6@cyberxdesigns.com> Message-ID: Yeah SoftLayer is a good host. What was the other dedicated host also, that was owned by ex-RackSpace, for dedicated? On Tuesday, March 27, 2012, Hans C. Kaspersetz wrote: > > > On Mar 27, 2012, at 12:19 PM, Matthew Kaufman wrote: > >> If you use RackSpace, I encourage NOT to use their cloud service. I was billed over 4 grand in one month for minimal and hard to track usage by the 'hour'. >> >> I hate to say this but I'd recommend Linode over RackSoace if you want a VPS. >> > > SoftLayer cloud offers fixed monthly pricing and works well. > > Hans Kaspersetz > Cyber X Designs > > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation > -------------- next part -------------- An HTML attachment was scrubbed... URL: From danielc at analysisandsolutions.com Tue Mar 27 14:01:40 2012 From: danielc at analysisandsolutions.com (Daniel Convissor) Date: Tue, 27 Mar 2012 14:01:40 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> Message-ID: <20120327180139.GA29478@panix.com> Hi David: On Tue, Mar 27, 2012 at 10:47:16AM -0400, David Mintz wrote: > > Yeah, I assembled the regex based specifically on the malicious code that I > was looking at in all my files. I suppose the trick is to fashion a regex > that catches an actual eval call inside php tags -- there's always a > chance that the string "eval" is is somehow legitimately contained inside > some php tags. Sure, that's why you identify the files using grep, then do targeted editing. If all uses found need to be blown away, then you can use your regex search and replace. Otherwise handle the "good" files manually and direct your regex search and replace handle the rest. Oh, and Except when it really needs to, like for writing data to a file-based > cache, or accepting file uploads. How do you recommend handling those cases? Specific directories can be left writable. > I have been wondering, why not chmod ALL your php files to 400? Indeed I > did this with one site after my infection, but not the several others. Then > I got hit again, but the site whose php files were 400 was not affected -- > probably not a coincidence. Probably? Certainly! > It's perhaps a bit of an inconvenience when you > need to update/overwrite, but I see no reason we can't relax permissions > temporarily for code deployments and reset them back when we're done. That's why you automate your deploy process. Easiest way is via shell scripts. chmod writable; update files; chmod readable. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 From david at davidmintz.org Tue Mar 27 15:55:27 2012 From: david at davidmintz.org (David Mintz) Date: Tue, 27 Mar 2012 15:55:27 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> <23739793-FBA3-431B-9B69-6F64CF8166A6@cyberxdesigns.com> Message-ID: On Tue, Mar 27, 2012 at 12:30 PM, Matthew Kaufman wrote: > Yeah SoftLayer is a good host. What was the other dedicated host also, > that was owned by ex-RackSpace, for dedicated? > > > you're probably thinking of Slicehost. -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.horning at planetnoc.com Tue Mar 27 16:04:41 2012 From: dan.horning at planetnoc.com (Dan Horning) Date: Tue, 27 Mar 2012 16:04:41 -0400 Subject: [nycphp-talk] I've been hit with an eval(base64_decode("....")) injection attack In-Reply-To: References: <20120325200755.GA12577@panix.com> <23739793-FBA3-431B-9B69-6F64CF8166A6@cyberxdesigns.com> Message-ID: <498b9d1c-b4d6-4858-ac07-9df113641755@email.android.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 David Mintz wrote: >On Tue, Mar 27, 2012 at 12:30 PM, Matthew Kaufman >wrote: > >> Yeah SoftLayer is a good host. What was the other dedicated host >also, >> that was owned by ex-RackSpace, for dedicated? >> >> >> >you're probably thinking of Slicehost. Or ServerBeach which was rack space prior... (peer 1 owns it now) - -- Dan Horning American Digital Services - Where you are only limited by imagination. dan.horning at planetnoc.com :: http://www.americandigitalservices.com 1-518-444-0213 x502 . toll free 1-800-863-3854 . fax 1-888-474-6133 PO Box 746, Troy, NY 12181 -----BEGIN PGP SIGNATURE----- Version: APG v1.0.8 iIkEAREIAEkFAk9yHVlCHERhbiBIb3JuaW5nIChwZXJzb25hbCBrZXkgdmFsaWRh dGlvbikgPGRhbi5ob3JuaW5nQHBsYW5ldG5vYy5jb20+AAoJEBPonbvWHQnDac8A n1/qHaSZ0UG8A448Fiwe2GoYSSw/AJ9vuQBCaKw5FmdGJY89Yw15u97YsA== =KErV -----END PGP SIGNATURE-----