Re: why is this not a bug?

From: Date: Thu, 13 Jul 2000 16:04:44 +0000
Subject: Re: why is this not a bug?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6472@lists.php.net to get a copy of this message
Hmm... on my bsd system... philip@illiad:~/tmp% cat foo.c #include <stdio.h> void main() { FILE *fd; fd = popen("/usr/turkey", "w"); if( fd ) { printf("popen succeeded\n"); }else { printf("popen failed\n"); } } philip@illiad:~/tmp% ./a.out popen succeeded philip@illiad:~/tmp% /usr/turkey: not found philip@illiad:~/tmp% ??? Isn't popen supposed to return NULL? This would appear that it's copmletely outside of PHP, but still... am I missing something? On Thu, 13 Jul 2000, Dan Donaldson wrote: > On 7/12/00 at 11:33 PM, rasmus@php.net (Rasmus Lerdorf) wrote: > > > > If I configure php4 such that I tell it sendmail_path is /usr/local/turkey > -t > > > (not a valid filename) it, still merrily returns '1' when I invoke mail(). > How > > > can it return a true value on a command that has to fail? > > > > > > This is pretty frustrating... > > > > > > > > > php4pl2/OSX/Apache 1.3.12 > > > > From ext/standard/mail.c: > > > > sendmail = popen(sendmail_path, "w"); > > > > if (sendmail) { > > fprintf(sendmail, "To: %s\n", to); > > fprintf(sendmail, "Subject: %s\n", subject); > > if (headers != NULL) { > > fprintf(sendmail, "%s\n", headers); > > } > > fprintf(sendmail, "\n%s\n", message); > > ret = pclose(sendmail); > > if (ret == -1) { > > return 0; > > } else { > > return 1; > > } > > } else { > > php_error(E_WARNING, "Could not execute mail delivery program"); > > return 0; > > } > > > > From the popen() man page: > > > > RETURN VALUE > > The popen function returns NULL if the fork(2) or pipe(2) calls > > fail, or if it cannot allocate memory. > > > > So, either your OSX is broken (which is not all that unlikely) or your > > sendmail_path is not what you think it is. Write yourself a tiny little C > > program to test popen() on your system. > > > > OSX doesn't appear to be broken - for example, I can use sendmail services > through other interfaces (such as mailviewer). And I can get information from > sendmail using /usr/sbin/sendmail -whatever without problems from the shell... > > If I invoke /usr/sbin/turkey -t from the command line, I get a failure (shell > returns command not found) - as of course it must, since it corresponds to > nothing... but mail() reports '1'. This can't have anything to do with sendmail, > and the OS is doing what it ought...or isn't it? > > I'm not a c programmer, so it's not going to happen that I use the method you've > described - although I understand the logic fine and can see why that would be a > useful test. > > Are there any living examples of people using php4 on and OSX box (BSD) with the > mail() function working? I just love this tool, but this is a show stopper... > > BTW, if you take a look at www.surveys123.com, you can see an online survey > building system that I built with php/mysql... > > ----------------------------------------------------- > omnivore: omnivore@sympatico.ca > Networked and Desktop interactive technologies > tel: +1 416 603 3309 > > Build surveys online with surveys123: http://www.surveys123.com > > Your Online Science & Astronomy Superstore: > http://www.e-sci.com > >

« previous php.general (#6472) next »