I have been using 'PHP Desktop'(>=5.3 on Windows 7 x64) to create an app that caters to a local pharmacist for his billing and inventory.
He uses a EPSON LX300+II Dot matrix printer(USB type) with support for ESC/POS system to print his sale bills. I use Mike42's PHP ESC-POS module that easily enables me to send POS print commands to the printer and it works just fine.
However, it seems that all of the tedious work that I have put into building this app will never see the light of day. The print commands work fine only for about an hour. What I mean is, almost an hour after I take the last print, the printer refuses to respond and any further print request.
Here is a what I spotted in the debug log:
`
17:03:18.450 INFO: GET 200 /home/api/printSale/?invoice=A201
[1206/170318:INFO:CONSOLE(160)]
"ERROR", source : http://127.0.0.1/vendor.f98484e540fba09768ba.bundle.js (160)
[ 1206/170318 : WARNING : dns_config_service_win.cc(673)] Failed to read DnsConfig.
`
This is very unlikely to be a JS error. My client side interface is based on Angular JS 2, and all it does is send an API request to a PHP page at:
"/home/api/printSale/?invoice=A201"
My php script finds and generates a raw text format of the invoice 'A201' and then sends it to an external ESC-POS PHP module by Mike42(Git). The printing is entirely handled by this module and it works too....but only for an hour or so as I mentioned earlier.
An hour later this is the exception thrown by PHP:
"Warning : copy(\PC-Name\Printer-Name): failed to open stream: No such file or directory.."
It keeps on popping up until I remove and re-install the printer again. It works fine for about an hour and the same thing repeats.
I have no earthly clue of what is going on as I have tried most of the fixes i found online from disabling antivirus/firewall, granting full access and permissions, heck the printer even seems to be printing via the command prompt.
I wonder if "Failed to read DnsConfig" has something to do with it.
Thank you for your time.
function printSale($data, $printer_name)
{
try
{
$connector = null;
$host_name = gethostname();
$connector = new WindowsPrintConnector('smb://'.$host_name.'/'.$printer_name);
$printer = new Printer($connector);
$printer -> feedDownEpsonLX300(100);
$printer -> tinyFontEpsonLX300();
$printer -> text($data); //Printing begins here
$printer -> feedUpEpsonLX300(100);
$printer -> cut();
$printer -> close();
}
}