logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: can't popen to exim
Author
jobeard



Joined: 29 May 2015
Posts: 2
Location: SoCal

PostPosted: Fri 29 May '15 18:44    Post subject: can't popen to exim Reply with quote

Works as php program, but doesn't when invoked within a webpage. Here's the synopsis:

Platform:
Win/7 Pro Sp1
Apache 2.4
Php 5.6
Cygwin emulator gives Linux/Unix emu and has
Exim 4.84-1 (alternative to sendmail)

program: sendit.php
Code:
hndl popen( exim ... )
      fwrite(hndle, email_headers);
      fwrite(hndle, email_body);
   fflush(hndle);
   fclose(hndle);

(a)launch from user account
    php sendit.php -> exim/exim_main.log updated
    reports 368 bytes sent to exim
    -> email arrives

>> demonstrates sendit.php works & Exim config and permissions are correct

(b)launch from apache account uid(apache) gid(srvc)
    php sendit.php -> exim/exim_main.log updated
    reports 368 bytes sent to exim
    -> email arrives

>> demonstrates sendit.php runs from any account

(c)launch from within a web page
Apache is run from its own uid/gid as in (b)
page.phtml
    sendit.php
    -> NO update to exim log
    -> no mail recv'd
    reports same NNN bytes send to exim
    *NO* I/O errors

      *I* fwriting_stream 368 bytes ...
      *** wrote body fragment 368
      *** wrote total 368
      *I* Wrote Body:(368) of 368
      *I* Wrote EOT(5) of 5
      *I* FLUSHING pipe
      *I* closing pipe
      *I* is closed pipe
      *I* returning 3


adding -d+deliver+host_lookup+lookup+rewrite options to the popen(), yields nice trace - -
EXCEPT when run withing Apache - - nothing shows up

Apache cfg has ExecCGI in the directory and other php / perl programs run there.
Issue is Exim is not within the Apache environment (/usr/bin/exim)

So, created link /usr/bin/exim -> docroot/exim
and reference this instance popen(docroot/exim ...)

Still fails to deliver via pipe -> exim

Any ideas???
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sat 30 May '15 20:18    Post subject: Reply with quote

Are your php.ini settings the same on the command line as when you run it on apache?
Back to top
jobeard



Joined: 29 May 2015
Posts: 2
Location: SoCal

PostPosted: Sat 30 May '15 21:33    Post subject: Reply with quote

James Blond wrote:
Are your php.ini settings the same on the command line as when you run it on apache?
absolutely

#STATUS: SOLVED 2015-05-30
Issue is Windows + Cygwin pathing

PHP tolerates Cygwin as $PATH is available.
Running within
Apache LoadModule php5_module "c:/php/php5.6/php5apache2_4.dll" does not

Must use an absolute WINDOWS path like
c:/cygwin/bin/exim-4.84-1.exe within the server.

php cmdPath_Tests.php

uses file_exists($path) exec to
find that path usable within Apache

Jeff@JeffPC7%
case 0 0
$ ls -l /usr/bin/exim
lrwxrwxrwx 1 Administrator None 24 Apr 6 09:19 /usr/bin/exim -> /usr/bin/exim-4.84-1.exe

Jeff@JeffPC7%
$ ls -l /usr/bin/exim /cygwin/bin/exim{,-4.84-1}.exe c:/cygwin/bin/exim-4.84-1.exe
case 1 1
ls: cannot access /cygwin/bin/exim.exe: No such file or directory
ls: cannot access /cygwin/bin/exim-4.84-1.exe: No such file or directory
lrwxrwxrwx 1 Administrator None 24 Apr 6 09:19 /usr/bin/exim -> /usr/bin/exim-4.84-1.exe

case 3 1
-rwxr-xr-x 3 Jeff None 1192467 Jan 25 19:16 c:/cygwin/bin/exim-4.84-1.exe

/usr/bin/exim
0 0 /usr/bin/exim

/usr/bin/exim-4.84-1.exe
0 1 /usr/bin/exim-4.84-1.exe

which: no exim-4.84-1.exe in (/cygwin/bin)
1 1 File Exists
<br> cmd 1 1 /cygwin/bin/exim-4.84-1.exe
results: <NOTHING>

/usr/bin/exim-4.84-1.exe
2 1/usr/bin/exim-4.84-1.exe

<br>*I* found: 3 1 c:/cygwin/bin/exim-4.84-1.exe
<br> cmd results:
2015-05-30 11:58:24 NP6FDA-000530-QD Completed
ie: email sent
Back to top


Reply to topic   Topic: can't popen to exim View previous topic :: View next topic
Post new topic   Forum Index -> Other Software