php-general Digest 3 Dec 2010 05:37:01 -0000 Issue 7067
Topics (messages 309819 through 309825):
php mail() and sendmail/smtp
309819 by: Michael Crowl
309820 by: Peter Lind
309821 by: Daniel P. Brown
Queuing servers
309822 by: larry.garfieldtech.com
309823 by: Alister Bulman
PHP 5.2.15RC2 & 5.3.4RC2 Released for Testing
309824 by: Ilia Alshanetsky
Re: preg_match fails to resolve variable as a subject
309825 by: Da Rock
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Okay, I know this is a Sendmail/SMTP admin issue, but it's PHP-related
and I figured someone here might have a clue or might have solved this
issue before. I've come into this dev server after many hands have
touched it, and I'm not quite sure how to proceed, nor am I a Linux genius.
We're using localhost on this in-house CentOS server for mail() with
sendmail_path, sendmail_from, etc. set properly. I can get test emails
sent to me using mail(), but my client can't get any script emails on
their domain's mail server, which is on hostmonster.
The daemon response emails are stuck in the queue as deferred - and what
I've found through logs is that they're being rejected by the client's
mail server because SMTP is sending it FROM
"<[email protected]>", even though that should be overridden
when using mail() and our ini settings and headers. So that's a
compound address of the apache account and 'new-host' which was
apparently the machine name that was never changed in the beginning.
My mail server apparently doesn't care that it can't do a reverse lookup
on that non-existent subdomain and account, but the client's does.
Also, we have Redmine running on the same server, and it sends admin
emails out just fine - however, I don't think it calls sendmail directly
like our PHP install, but connects directly to the local SMTP server.
And I have tested a local telnet session to SMTP a mail manually, and
that got through fine. So it seems to be how PHP is calling Sendmail,
or Sendmail itself.
Sendmail is being called as "/usr/sbin/sendmail -t -i" in the ini.
Possible solutions? I'm a little frazzled and a little undereducated here.
-- m
--- End Message ---
--- Begin Message ---
2010/12/2 Michael Crowl <[email protected]>:
* snip *
> Also, we
> have Redmine running on the same server, and it sends admin emails out just
> fine - however, I don't think it calls sendmail directly like our PHP
> install, but connects directly to the local SMTP server.
Sounds like a solution to me: connect to port 25 on the mail server
instead of going through sendmail. Plenty of good mail libraries out
there (swiftmailer, phpmailer come to mind).
Regards
Peter
--
<hype>
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
</hype>
--- End Message ---
--- Begin Message ---
2010/12/2 Michael Crowl <[email protected]>:
>
> Possible solutions? I'm a little frazzled and a little undereducated here.
Use the under-appreciated fifth paramter in mail() to pass the -f
flag to sendmail, like so:
<?php
$to = '[email protected]';
$subject = 'This is an emample for a php-general request!';
$body = 'This is the body of the email.';
$headers = "From: [email protected]\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$sendmail_flag = '[email protected]'; // Note the lack of
space between the flag and variable
mail($to,$subject,$body,$headers,$sendmail_flag);
?>
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/
--- End Message ---
--- Begin Message ---
Hi folks.
I have a project coming up where I will need to process a bazillion (OK,
a few million) records, possibly with multiple steps. (In this case I'm
reading data from one data archive into an Apache Solr server.) This is
a natural use case for a queue server, I believe, and while the
requirements of the project do not dictate a language it makes sense to
me to use PHP for the processing code since 1) Other parts of the
project will be using it for web-facing logic and 2) It's the language I
know best.
I'm trying to select a queue server to use. The two I'm investigating
in particular are Beanstalkd (http://kr.github.com/beanstalkd/) and
Gearman (http://gearman.org/). In this case I do need a reliable queue,
even if that means a record gets processed multiple times by accident
(which in this use case is fine).
Has anyone worked with either of these systems? Any war stories to
share, good or bad? Any guidelines on the number of resources we need?
For Beanstalk, I've found two user-space PHP libraries, one of which is
apparently dead. The other is:
https://github.com/pda/pheanstalk/
For Gearman, there appears to be both a PECL module and a PEAR module.
http://pear.php.net/package/Net_Gearman/
http://pecl.php.net/package/gearman
(Naturally they do not appear to be mirrors of each other, just to make
life difficult.)
I do have access to install PECL modules on the server(s) in question if
appropriate.
Any experience/advise/horror stories that would help us settle on a
queue and API library?
--Larry Garfield
--- End Message ---
--- Begin Message ---
On Thu, Dec 2, 2010 at 10:10 PM, [email protected]
<[email protected]> wrote:
> Hi folks.
>
> I have a project coming up where I will need to process a bazillion (OK, a
> few million) records, possibly with multiple steps. (In this case I'm
> reading data from one data archive into an Apache Solr server.) This is a
> natural use case for a queue server, I believe, and while the requirements
> of the project do not dictate a language it makes sense to me to use PHP for
> the processing code since 1) Other parts of the project will be using it for
> web-facing logic and 2) It's the language I know best.
>
> I'm trying to select a queue server to use. The two I'm investigating in
> particular are Beanstalkd (http://kr.github.com/beanstalkd/) and Gearman
> (http://gearman.org/). In this case I do need a reliable queue, even if
> that means a record gets processed multiple times by accident (which in this
> use case is fine).
>
> Has anyone worked with either of these systems? Any war stories to share,
> good or bad? Any guidelines on the number of resources we need?
I did a presentation at the PHP London meetup in May - my slides with
some good Beanstalk points are at:
http://abulman.co.uk/2010/05/queues-and-beanstalkd/
Gearman does have the advantage of being pretty much drop-in and work,
calling remote PHP functions (or other languages that are setup as
workers). With beanstalkd, there is no solid framework in place yet
(though there are a couple of things around, I've seen one for
CakePHP, and something for Drupal I think). That said, it's not hard
to write one, depending on your personal choice of development
framework, or not. Both have solid C-based daemons backing them up
(which are so much easier to run than the original Perl daemon).
I see Beanstalk as more flexible though, the Priorities, TTR limits,
tubes and optional delays make for a powerful set of tools within the
queue itself.
Alister
--- End Message ---
--- Begin Message ---
The second release candidates of 5.2.15 and 5.3.4 were just released
for testing and can be downloaded here:
http://downloads.php.net/ilia/php-5.2.15RC2.tar.bz2 (md5sum:
423e70e49f8defd63c6a08d824357f36)
http://downloads.php.net/johannes/php-5.3.4RC2.tar.bz2 (md5sum:
36f7854304f9ecaa28d444456f0eb163)
The windows binaries will be available shortly at: http://windows.php.net/qa/
Since the first release candidate, we have not seen a large number of
changes and and there are no show-stopper bugs for either version. At
this point we both feel that the next logical step is the final
release, which we would like to schedule a week from now.
Given that this is the case, we would like to ask all developers to
refrain making commits to the 5.3 and 5.2 branches, unless these
constitue critical bug fixes, in which case please let Johannes and
myself know about these fixes ahead of time. This way we can avoid
last minute regressions, especially so for the 5.2.15 release, which
is the final one in that series.
Ilia Alshanetsky Johannes Schlüter
PHP 5.2 Release Master PHP 5.3 Release Master
--- End Message ---
--- Begin Message ---
On 11/29/10 09:10, Richard Quadling wrote:
On 27 November 2010 04:45, Da Rock<[email protected]> wrote:
On 11/27/10 13:51, Tamara Temple wrote:
On Nov 26, 2010, at 7:28 PM, Da Rock wrote:
On 11/27/10 00:57, Richard Quadling wrote:
On 26 November 2010 00:07, Da Rock<[email protected]>
wrote:
preg_match("/(\d{1,3})(\.)$/", exec($mixer . ' ' . $command),&$matches)
Can you ...
var_dump(exec($mixer . ' ' . $command));
I wonder if the output includes a new line which you are not
accounting for in the regex.
Haven't tried yet, but isn't that what $ is for? End of line?
$ matches end of line, but since your last match expression is to match
explicitly the character '.' before end of line, and there's a newline, it
won't match. Again, use trim() to get rid of the newline character at the
end of the string returned by exec(). Looking at the output or
And exec only gives one line- the last line of the output of the command.
You have to provide a reference to an array for the entire output.
var_dump gives:
string(41) "Mixer vol is currently set to 75:75"
It also looks like \d{1,3}\. won't match anything in the output string
given by the command.
Thank you for that- that did it. I removed the \.
I am a little confused though; that regex was tested on several test sites
and was deemed accurate on them, and one of them actually supplied the
preg_match code. And if I run the command on a shell it actually outputs
exactly the right subject for the regex- not to mention it got printed
inadvertently (using system() ) via the php exactly the same. So I don't
think I missed it somehow.
What I have constantly seen come up (shell and php/html) is: Mixer vol is
currently set to 75:75. (including the period)
Don't get me wrong- you guys make sense; my system doesn't. I need to get to
the bottom of this so I can ensure my code will port well. I don't want to
get it all working and find it breaks when I run it on another system,
albeit same OS (FreeBSD). Could be updates or variations of releases.
Just to check again, I ran the command on the shell again and sure enough
the period is no longer there- but I can't for the life of me figure out
when that changed as this code has never worked (and yes, I added in the \.
to match the end of line because it originally wasn't working). Another
great mystery? Weird... :)
Thanks again guys.
The regex is a valid regex. It's just useless for the data you are providing it.
I'm wondering what is missing from your output? The var_dump says the
text is a 41 character string, but the data you provided only has 36
characters in it.
What elements of the string do you want to capture?
/:(\d++)/ would catch the number after the :
Apologies for the delay.
That works, except it will catch all instances. I need it to catch the
last number specifically and not the period. The output will also output
a previous and new reading- I need the new reading. And I also need to
allow for the possibility of a period. So.... here's what I have:
/(\d++)[^.]?$
Which works as long as there is no period at the end. I just can't seem
to get my head around it. I need a guru... :)
--- End Message ---