php popen(exim) from a webpage -
problem: apache accessing programs in /usr/bin
platform:
win/7 pro sp1 apache 2.4 php 5.6 cygwin emulator gives linux/unix emu , has exim 4.84-1
program: sendit.php
hndl popen( exim ... ) fwrite(hndle, email_headers); fwrite(hndle, email_body); fflush(hndle); fclose(hndle);
(a)launch user account php sendit.php -> exim/exim_main.log updated reports 368 bytes sent exim -> email arrives
demonstrates sendit.php works & exim config , permissions correct
(b)launch apache account uid(apache) gid(srvc) php sendit.php -> exim/exim_main.log updated reports 368 bytes sent exim -> email arrives
demonstrates sendit.php runs account
(c)launch within web page apache run own uid/gid in (b)
- page.phtml sendit.php -> no update exim log
-> no mail recv'd
reports same nnn bytes send 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 closed pipe
i returning 3
adding -d+deliver+host_lookup+lookup+rewrite options popen(), yields nice trace - -
except when run withing apache - - nothing shows
apache cfg has execcgi in directory , other php / perl programs run there. issue exim not within apache environment (/usr/bin/exim)
so, created link /usr/bin/exim -> docroot/exim , reference instance popen(docroot/exim ...)
still fails deliver via pipe -> exim ideas???
btw: have used popen in webpages several places success , yes, verifed popen return
$pipe = popen( ... ...);if ($pipe === false) die("*fe*);
status: solved 2015-05-30
issue windows + cygwin pathing
php tolerates cygwin $path available. running within apache loadmodule php5_module "c:/php/php5.6/php5apache2_4.dll" not
must use absolute windows path c:/cygwin/bin/exim-4.84-1.exe within server.
php cmdpath_tests.php
uses file_exists($path) exec find path usable within apache
jeff@jeffpc7% case 0 0 trying: $ 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 trying: -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 cmd 1 1 trying: /cygwin/bin/exim-4.84-1.exe results:
/usr/bin/exim-4.84-1.exe 2 1 trying: /usr/bin/exim-4.84-1.exe
i found: 3 1 trying: c:/cygwin/bin/exim-4.84-1.exe
cmd results: 2015-05-30 11:58:24 np6fda-000530-qd completed ie: email sent
Comments
Post a Comment