#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Location
    China
    Posts
    21
    Rep Power
    0

    Exclamation Php_printer.dll on Windows Server 2003


    Hi,

    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.

    -Ifor
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,759
    Rep Power
    9397
    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?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Location
    China
    Posts
    21
    Rep Power
    0
    Originally Posted by requinix
    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?
    Thanks for the reply.

    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?

    Thanks again.
  6. #4
  7. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,759
    Rep Power
    9397
    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.
    Code:
    C:\>print /?
    Prints a text file.
    
    PRINT [/D:device] [[drive:][path]filename[...]]
    
       /D:device   Specifies a print device.
    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).

    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.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Location
    China
    Posts
    21
    Rep Power
    0
    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?

    Thanks
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Location
    China
    Posts
    21
    Rep Power
    0
    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.

    -Ifor

    Comments on this post

    • DonR agrees : Thanks for coming back and revealing the "fix/workaround" that you used.

IMN logo majestic logo threadwatch logo seochat tools logo