August 23rd, 2013, 01:48 AM
Php_printer.dll on Windows Server 2003
Hopefully you can help me, I've installed an ordering system in a bar, it's mysql-driven php. To print receipts I used php_printer.dll, the server machine is running Windows XP and I got a version compiled for PHP 5.4 and it works with no problem.
The second bar has a server running Windows Server 2003 and I can't get it to work. I've done the same as on the XP machine, added a line to php.ini and moved the dll into the ext folder, but it doesn't work. It also doesn't come up in phpinfo(). I used the same dll as for XP, I think this should work.
Any ideas? I need to get this printer function working asap!
Thanks in advance.
Also, I have no experience using Windows Server and the entire system is in Chinese, which is making things even more difficult, gotta love China.
August 23rd, 2013, 04:30 AM
The printer extension is old and unmaintained, to put it nicely. It's notoriously difficult to deal with - I'm surprised you got it to work for XP, but if you did then Server 2003 shouldn't be much harder.
Have you tried compiling it for that machine? Anything happen if you restart with display_startup_errors on?
August 23rd, 2013, 04:34 AM
Thanks for the reply.
Originally Posted by requinix
I would have no idea how to compile the dll from source.
I'll be heading there in a few days and will try with turning error display on.
If it is so archaic, what do people usually use now?
August 23rd, 2013, 04:43 AM
Don't know. Quite rare where somebody needs to print from PHP running on a server.
If you're printing a text file then there's actually a command-line "print" you can run from within cmd.exe.
PowerShell gives you access to at least most of the .NET framework so you could print using that too (wouldn't know how off the top of my head).
Prints a text file.
PRINT [/D:device] [[drive:][path]filename[...]]
/D:device Specifies a print device.
If not straight text then there may be an application that can read your file type and print from the command line. For example, Foxit Reader for PDFs.
August 26th, 2013, 10:44 AM
Thanks for the input. Unfortunately I'm printing to a thermal receipt printer which I think only accepts ESC/POC line by line input. I'm heading there tomorrow to have another look.
I saw somewhere that maybe a missing msvcr71.dll could be the problem, as I believe Windows Server doesn't come with this as standard. But I can't be sure, any other ideas why it would work on XP but not on Win Server?
September 11th, 2013, 05:05 AM
Hi, just for anyone interested, I solved the problem by using a different method.
I used fpdf to dynamically generate a pdf which I then sent using shell_exec to ghostscript to print in the background.
Comments on this post