We have htmlprint running on a 2003 server 32 Bit just fine. We have now installed a 2008 Server running 64 bit, and my 64bit Apache/PHP can't run it, I keep getting -11 as a result, but, it is the exact command as running on the 32bit machine. Do you all have a 64Bit version over htmlprint.exe?
Customer
------------------------------------------
Hi all,
I have a server running Windows server 2003, 32bit. At present I have Apache 2.0 on that server with the PHP modules. So I have an web page that creates an HTML page and then using php to execute htmlprint.exe using php passthru function. This has been working for about 2 years. I am running the WAMP Stack for php and apache.
Basically, Apache->php(passthru)->htmlprint.exe
I want to up grade this sever to Windows server 2008, 64Bit. I have taken the latest Bitnami WAMP stack (Apache 2.2) and installed it on the new server and installed HTMLprint.exe for testing.
I can run php(passthru)->htmlprint.exe and it works from a Dos CMD window, with my login being part of Admin group.
But if I use the web page working on the 2003 server moved to the 2008 system, htmlprint.exe returns an -11 when called from php(passthru) via an Apache web page, and it fails to print, and a cmd*32 appears hung in the process list.
I suspect some kind of security issue, but, there doesn't seem to be any method of tracking down the problem. Apache calls htmlprint.exe (via the php passthru function of phpmod) as SYSTEM user that should have authority to run the htmlprint.exe
I am wondering if you have anyone other users that have ran into the same kind of issue when moving from Server 2003 32 bit to Server 2008 64 bit?
Customer
------------------------------------------
This file name is printtest.php.
When run from command line: E:> php printtest.php
it prints the html page.
When run from the browser through Apache it doesn't work.
Yet I can put another EXE, that I compiled, in the same verydoc directory and it runs fine from the browser through php/apache.
It just doesn't make sense.
RUN HTMLPRINT VIA WEB PAGE!!
The following is the sample of my PHP code,
<?php
$passcmd = 'D://verydoc//htmlprint_cmd//htmlprint.exe -color 2 -hfflag on -footer "Fri, November 08, 2013 - 03:13:54 PM" -printbgcolor 1 -marginbottom 25 -margintop 25 -marginleft 20 -marginright 20 -paper "8.5x14in" -hidewindow -timeout1 15 -timeout2 25 -printer "Office Xerox PCL6" E:/WebRoot/www/public_html/OrderDet27163/47642/printpagek01.html';
session_write_close();
print ("<Br>RESULTS:" . $passcmd . "\n");
passthru ($passcmd,$msgResults);
exit ("\nRESULTS:" . $msgResults);
session_write_close();
?>
Customer
------------------------------------------
This problem is caused by permission issue, we suggest you may run htmlprint.exe inside an interactive user account instead of default Local System user account to try again, this will solve this problem to you.
You can use CmdAsUser.exe to run htmlprint.exe inside an interactive user account, CmdAsUser.exe can be downloaded from following web page, you may download it to try,
https://www.verydoc.com/exeshell.html
You may also run htmlprint.exe by manual in Cmd window to try again, can you work fine from CMD window by manual on 2008 Server 64 bit system?
VeryPDF
------------------------------------------
To solve this problem the WAMP stack was installed on Windows 2008 64Bit as local internal user "SYSTEM". Regardless of what I tried to do to give "SYSTEM" user permissions, the call from PHP (passthru) to HTMLPRINT.EXE failed to complete.
After hours of testing, I found that there was no way to give "SYSTEM" enough permissions to make this work.
What I found is that I went to the System Services where you can start and stop a service process, and changed wampapache to start as Local Administrator, giving the start process local Administrator's login and password. This did the trick.
By the way none of the work arounds sent to me in your response helped what so ever including CmdasUser.exe, etc..
Customer
------------------------------------------
Thanks for your kindly information, your solution will helpful for our other customers in the future, thank you.