简体   繁体   中英

installing php_printer on wamp server

Ive been googling around on how to install the php_printer.dll for wamp server, nothing came up. Perhaps, anyone know how to install that ext? Basically, im trying to use php printer function and i need that extension as i heard. i tried http://www.issociate.de/board/goto/751941/Call_to_undefined_function_printer_open().html to install on wamp server, but still give me error in the webpage? i added the extension: php_printer.dll in php.ini

testing code:
<?php
$filename = "test page";
///////
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
///////
$handle = printer_open("HP80AA62");
printer_set_option($handle, PRINTER_MODE, "raw"); 
printer_write($handle,$contents);
printer_close($handle);
?>

Although I don't have much experience with installing/enabling extensions myself, this has worked for me in the past:

  1. Ensure that php_printer.dll is listed under the "ext" directory inside of your PHP installation. If it isn't there, you will need to download that extension and save it under the "ext" directory.
  2. Add the extension inside of php.ini.
  3. Reboot your server and try again.

Hope that helps,
spryno724

Not

extension: php_printer.dll

You should use

extension=php_printer.dll

Also, be noticed that there are plenty of versions of php_printer.dll and most of them don't work on Windows platform.

Try to get fresh one: pecl-5.2.6-Win32.zip .

Also, consider this line form PHP: Printer manual

Windows users must enable php_printer.dll inside of php.ini in order to use these functions. A DLL for this PECL extension is currently unavailable.

I've just tried to enable it on Wamp (Windows XP) and it doesn't work.

see the path for "Loaded Configuration File" in your php info page. then add extension=php_printer.dll on that php.ini file. mine, it was "D:\wamp\bin\apache\apache2.4.4\bin\php.ini" at "Loaded Configuration File" on php info page.

after you added, it may give a warning like, php startup: unable to load dynamic library 'path/to/php_printer.dll' - the specified module cannot be found on wamp

I got solved this by changing versions of Apache, PHP and MySQL too. correct versions are: PHP 5.2.6 MySQL 5.0.45 Apache 2.2.9

Hope this helps.

If you can use xampp 1.6.8 version it will fix these issues. it has php 5.2.6 and also php_printer.dll file has saved in ext folder in php folder. so you will only have to un-comment the line extension=php_printer.dll in php.ini file which noticed in the path under "Loaded Configuration File" section on php info page. you can find that version of xampp from www.oldapps.com

After enabling the php_printer.dll in your ini, I'd first make sure you did it in the good INI file (by looking at "Loaded Configuration File" in phpinfo()).
Then if proper INI is loaded, but the module still isn't working, I'd go to command prompt and try running php manually, like
php -v
That will probably give you an error with some more data on the issue - that error wouldn't be visible anywhere through your browser, that is - when you run a page in browser.

In the end - the error that you'll get reported will most probably be that you are trying to load the module which is compiled as ' thread safe ' while your version of PHP was compiled as non-thread safe . Or it will be the other way around. To overcome that, you'll need to download the proper version of PECL. I think that the link mentioned earlier by Wh1T3h4Ck5 is the thread-safe one.
You can try this link:
http://museum.php.net/php5/pecl-5.2.6-nts-Win32.zip or maybe here, it's a bunch of win32 binaries:
http://snaps.php.net/win32/

After you download that, take the printer dll from it, copy to your c:\php\ext (or whatever you use), reset the web server and it should work. If it does well, then the php -v shouldn't give errors any more. You can also use the php -m at that point, to list all the modules loaded, or just check the phpinfo() again.
That was the scenario I had and that's how I solved it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM