nodehopper Posted April 22, 2009 Share Posted April 22, 2009 I am completely new to PHP. I have a small MySQL database here at work with all the information for our Micro Biological Samples. A previous employee wrote up some internal web pages that interact with the database. The employee has left and I now need to move everything over to a WAMP Server. He had originally set it up on LAMP. Many of the pages have simply required editing paths and the database connection parameters. Not too tough, but now I am stumped. I plan on learning PHP, but before I have the luxury of time to do that I need to get a couple interfaces working ASAP. Both rely on PHP to print barcode labels with information taken out of the database and it is formatted in a temporary .prn file. As far as I can tell this all functions except for the printing. The previous employee used the smbclient in linux which is of course not available on Windows Server. Here is the code that I think does the printing. $fhandle=fopen("strainlabeltemp.prn","w"); fwrite($fhandle,$labelText); fclose($fhandle); print("<!-- $labelText -->\n"); $results=`/usr/bin/smbclient -N //labelprint/ZEBRA -c 'print strainlabeltemp.prn' 2>&1`; print("<!-- Results: $results\n -->\n"); Can anyone show me how to edit this so instead of calling smbclient on a LAMP server it will send this to the shared network Zebra printer that is set up on the WAMP server as LPT1. Please remember I am not familiar with PHP so I need a reply back that is geared toward a completed idiot like me. Thanks in advance for any help with this! Stephen Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 23, 2009 Share Posted April 23, 2009 not sure if this helps but $results=`/usr/bin/smbclient -N //labelprint/ZEBRA -c 'print strainlabeltemp.prn' 2>&1`; is basically a command line.. this is used later probably exec($results); or system($results); Now to fix this, you need to find out how to print from the command line this may work change $results=`/usr/bin/smbclient -N //labelprint/ZEBRA -c 'print strainlabeltemp.prn' 2>&1`; to $results='print /d:LTP1 strainlabeltemp.prn'; Quote Link to comment Share on other sites More sharing options...
nodehopper Posted April 23, 2009 Author Share Posted April 23, 2009 Thanks so much MadTechie. I ended up having to put a little more work into this, but you definitely got me pointed in the right direction. Also because of your answer I was able to do a better search and found one other post that added a few more pieces to the puzzle. I was also able to connect with the original author via IM to get the last little details iron out. see http://www.phpfreaks.com/forums/index.php/topic,207946.0.html thanks jonsjava ---indirectly helping me. So here is what I got to work. This is on a WAMP server on Win Server 2003 and it now prints to a Zebra barcode printer that is shared on the network. I just commented out the old Linux LAMP based call to the printer and changed it so it prints from the WAMP server. $fhandle=fopen("strainlabeltemp.prn","w"); fwrite($fhandle,$labelText); fclose($fhandle); print("<!-- $labelText -->\n"); $printcmd='PRINT /d:\\\\labelprint\ZEBRA strainlabeltemp.prn'; $results=shell_exec($printcmd); /*$results=`/usr/bin/smbclient -N //labelprint/ZEBRA -c 'print strainlabeltemp.prn' 2>&1`;*/ print("<!-- Results: $results\n -->\n"); Thanks again ...one and all for the help. I pan on hanging out here more and hopefully learning me some PHP. Sorry....I can't seem to find the option to mark this solved. Stephen Quote Link to comment Share on other sites More sharing options...
premiso Posted April 23, 2009 Share Posted April 23, 2009 Bottom left hand corner, above the quick reply. I marked it for you, but that is where it is for future reference. (It should show up as Mark Unsolved or something similar now). Quote Link to comment Share on other sites More sharing options...
nodehopper Posted April 23, 2009 Author Share Posted April 23, 2009 Thanks ......the bottom of my browser window was below the Gnome task bar on the bottom of my screen and I didn't see it. ... I did admit to being a complete idiot in my initial post .......... Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.