RE: [PHP] override built-in mail()
-Original Message- From: Thijs Lensselink [mailto:d...@lenss.nl] Sent: Friday, February 04, 2011 12:48 PM To: php-general@lists.php.net Subject: Re: [PHP] override built-in mail() On 02/04/2011 08:44 PM, Thijs Lensselink wrote: On 02/04/2011 08:38 PM, Steve Staples wrote: On Fri, 2011-02-04 at 20:25 +0100, Thijs Lensselink wrote: On 02/04/2011 04:59 PM, Steve Staples wrote: On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote: On 2/4/2011 5:37 AM, Steve Staples wrote: Hello Guys/Gals, it's friday (at least where I am it is) and I have an issue with a script that I just started using again. The problem is, is that it uses the built in PHP mail() function, and on my testing server, mail() doesn't work. The other issue, is that I use SMTP Auth to connect to my mail server, so that when mail sends out, it comes from my mail server so that there is less of a chance for being marked as SPAM. So, what I am looking to do, is use either the trust old Pear::Mail or PHPMailer scripts (I am sure there are other ones out there, but those are the 2 I am most familiar with). So now to my actual question. How can I override the built-in PHP mail() function, to let either of those 2 (or something else someone may suggest) to act in the same manner as the mail() function? Is this easy? I've googled, but haven't seen any reference to doing what I am looking to do (maybe I just can't google) Steve You cannot override a function. You will have to write a new function, my_mail or some such. Have it take the same arguments as the built in mail function, but internally it uses phpmailer or the likes. Then, do a search and replace for mail( with my_mail( One other possible option, which I had not contemplated until now, would be to actually specify a replacement sendmail executable when setting up the sendmail option in the php.ini. You could specify a php script that can run as though it was sendmail, accept the same arguments, etc... but do all the phpmailer stuff inside. Jim Lucas after posting this, and doing some more googleing, I found this: http://ca.php.net/manual/en/function.override-function.php it says you can override built-in php functions... I haven't tested to see if i can do it, but it seems possible... has anyone used this before? and will it do what I need? (this has been put on the back burner for today, so tonight I will look more deeper into this unless someone else has any luck in the mean time) TIA! Steve I would opt for using my_mail and not overriding a built-in function. It seems to me that it would just cause confusion for the next developer who takes care of your code. You know, that psychopathic programmer that knows your address. =) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code formatter
-Original Message- From: ken.gu...@gmail.com [mailto:ken.gu...@gmail.com] On Behalf Of Ken Guest Sent: Monday, January 31, 2011 3:26 PM To: Hansen, Mike Cc: php-general@lists.php.net Subject: Re: [PHP] Code formatter On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike mike.han...@atmel.com wrote: I've got an application that I'm fixing up and I'd like to run it through a code formatter. Is there something like Perl Tidy for PHP? If so, what are you experiences with it. No prob running it on the command line. It'd be great if it followed the PEAR coding standards. Have you found http://pear.php.net/package/PHP_Beautifier yet? ;) http://www.php.net/unsub.php Ken It mostly works ok. Unfortunately, there's a bug in it that removes blank lines. I found this one that seems to work: http://beta.phpformatter.com/ I'd rather have one I can run on the command line, but this will have to do. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Code formatter
I've got an application that I'm fixing up and I'd like to run it through a code formatter. Is there something like Perl Tidy for PHP? If so, what are you experiences with it. No prob running it on the command line. It'd be great if it followed the PEAR coding standards. Thx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Code formatter
-Original Message- From: Jonesy [mailto:gm...@jonz.net] Sent: Monday, January 31, 2011 2:25 PM To: php-general@lists.php.net Subject: [PHP] Re: Code formatter On Mon, 31 Jan 2011 13:27:42 -0700, Hansen, Mike wrote: I've got an application that I'm fixing up and I'd like to run it through a code formatter. Is there something like Perl Tidy for PHP? Something _like_ ??!!!http://www.google.com/search?q=tidy+php Unfortunately most of those are trying tidy up the HTML not the PHP code. Also, I was curious about those on this list and their experiences with any formatters they have used. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why the PEAR hate?
http://www.reddit.com/r/PHP/comments/e6zs1/how_many_of_you_use_pear_in_your_projects/ I'm still pretty new to PHP. Why the hate for PEAR? I've used a couple of PEAR modules without any issues. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] Why the PEAR hate?
-Original Message- From: Hansen, Mike Sent: Tuesday, November 16, 2010 10:24 AM To: 'Daniel Brown' Subject: RE: [PHP] Why the PEAR hate? -Original Message- From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel Brown Some of the PEAR stuff is older and unmaintained, which is one possible reason. More likely is that folks often expect PEAR to be the end-all, be-all, and that was never the intent. PEAR is supposed to jump-start a project and extend some built-in functionality, not provide a framework or do all of the work for folks who consider themselves programmers because they can iterate an array in just twenty-seven lines of procedural code. As for folks who say that PEAR and PECL don't work --- the most common reason for this is user error or system configuration issues. I've experienced the same issues myself over the years quite frustrating, but sure enough, it was my fault most times. Oops...I just replied to Daniel. Is PEAR supposed to be the CPAN for PHP, or is there another repository of PHP modules that is used by the typical PHP developer? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Template engines
I really like the idea of using a templating engine. Which one do you use? Why? For those that don't use templating engines, why don't you use them? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Eclipse, Komodo, Netbeans, Zend Studio, PHP Storm, other?
I'm about to do a lot of work on an existing code base and I think I'd like to try an IDE. I currently use VIM for most editing. What IDE are you using? What do you like about the one you are using? Which ones have you tried? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Set up MySQL + Apache 2.2.4 on Win XP.
-Original Message- From: Shreyas [mailto:shreya...@gmail.com] Sent: Tuesday, June 01, 2010 10:18 AM To: php-general@lists.php.net Subject: [PHP] Set up MySQL + Apache 2.2.4 on Win XP. PHP'ers, Please do not curse me for this. I am having a tough time to get this up and running. Can someone point me to a document which will help me do configure so that I can start learning and working on PHP ASAP? Please. I have attached the files under consideration. Here is my details : MySQL - 5.x Apache - apache_2.2.4-win32-x86-no_ssl.msi PHP base - C:\PHP Regards, Shreyas I realize that you have used EasyPHP. For others wanting to do this, Bitnami(http://bitnami.org/) has a WAMP stack too. What's nice is if you want to add Postgre, there's a module that installs into the stack too. There are other modules/apps that also integrate into your WAMP stack, so you don't have to have separate apache servers running all those different apps. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem install modules using PEAR
I'm on a older Solaris server with PHP 5.0.5. I'm trying to install Spreadsheet Excel Writer and the mail module using PEAR. /usr/local/php-5.0.5/bin/pear config-set http_proxy ##.###.###.##: /usr/local/php-5.0.5/bin/pear install Spreadsheet_Excel_Writer-0.9.2 -alldeps HTTP error, got response: HTTP/1.0 410 Gone Didn't receive 200 OK from remote server. (HTTP/1.0 410 Gone) Does anyone have any ideas on how I get past this HTTP error? Is it some PEAR config or network issue? How much of a pain in the butt would it be to manually install these modules? Will I end up in dependency hell? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Best Practices Book, Document, Web Site?
-Original Message- From: Bob McConnell [mailto:r...@cbord.com] Sent: Tuesday, March 02, 2010 7:52 AM To: pan; php-general@lists.php.net Subject: RE: [PHP] Re: Best Practices Book, Document, Web Site? From: pan Hansen, Mike mike.han...@atmel.com wrote in message news:7941b2693f32294aaf16c26b679a258d0efdc...@csomb01.corp.atm el.com... Is there a PHP Best Practices Book, Document, or web site that has information similar to Perl Best Practices but for PHP? Yeah, it's hard to find this stuff. A google search on {+Best Practices +PHP} returned only 4,340,000 hits. Maybe, some day, someone will think to write something up. The problem with this method is that scanning these results reveals conflicting and contradictory recommendations that are all over the place. Some are so old they may not even be valid PHP any more. Reading even a small subset of these pages is an exercise in frustration. But that makes sense as there doesn't appear to be any consistency nor consensus within the community, or even within some of the larger projects. Speaking of consensus, based on a recent discussion on the Perl Beginners mailing list, the Perl Best Practices book is now considered to be deprecated among the active Perl community. Many of its recommendations are obsolete and no longer used. It is long past due for a major rewrite. Bob McConnell Yep. Perl Best Practices is due for a rewrite/update. I came across this page that attempts to update it: http://www.perlfoundation.org/perl5/index.cgi?pbp_module_recommendation_commentary For PHP, I'll stick with the PEAR recommendations and do the best I can with whatever is missing. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best Practices Book, Document, Web Site?
Is there a PHP Best Practices Book, Document, or web site that has information similar to Perl Best Practices but for PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Excel Spreadsheets and PHP
-Original Message- From: Ian Robertson [mailto:irobert...@americantextile.com] Sent: Friday, February 19, 2010 1:28 PM To: php-general@lists.php.net Subject: [PHP] Excel Spreadsheets and PHP Hello, everyone. Just a quick question. What are you using, if anything, to create Excel spreadsheets with PHP? Thank you in advance. Pear Spreadsheet Excel Writer. http://pear.php.net/package/Spreadsheet_Excel_Writer Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What server am I authenticating to?
Yep. I found the issue in the apache config. Thanks, Mike -Original Message- From: Nathan Rixham [mailto:nrix...@gmail.com] Sent: Wednesday, January 13, 2010 1:12 PM To: Hansen, Mike Cc: php-general@lists.php.net Subject: Re: [PHP] What server am I authenticating to? Hansen, Mike wrote: -Original Message- From: daniel.egeb...@gmail.com [mailto:daniel.egeb...@gmail.com] On Behalf Of Daniel Egeberg Sent: Wednesday, January 13, 2010 11:39 AM To: Hansen, Mike Cc: php-general@lists.php.net Subject: Re: [PHP] What server am I authenticating to? On Wed, Jan 13, 2010 at 19:04, Hansen, Mike mike.han...@atmel.com wrote: I took over maint of an app, and the former maintainer is no longer available. I was under the assumption that authentication was done through an LDAP. How do I find out which LDAP server is PHP/Apache using? It might be right in front of my face in the apache config or php.ini, but I can't seem to find it. I'm not sure what it'd be called in those config files. There is no htaccess or htpasswd files that I could find on the server. Below is the code that I believe does the authentication. if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm=***'); header('HTTP/1.0 401 Unauthorized'); echo 'Access denied'; exit; } else If anyone can point me right direction, that'd be great. Mike Basic HTTP authentication is not using LDAP. You can use PHP_AUTH_USER and PHP_AUTH_PW to verify that the credentials are correct (they'll be populated with whatever the user entered). Exactly how you do that is up to you (hard code it, look in a database, LDAP, etc.). You then send the 401 response code along with WWW-Authenticate if the credentials aren't satisfactory. -- Daniel Egeberg I'll do some more digging. Would the LDAP authentication be happening from apache or from within PHP? The user only sees a username and password dialog. If they hit cancel, they get the Access denied which I was assuming was from this bit of code. Mike if it's ldap then most likely you should check the sites apache config file (apache-dir/sites-available) or .htaccess for something like.. Location / AuthType Basic AuthName *** AuthBasicProvider ldap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php