简体   繁体   English

在 wamp 服务器上安装 php_printer

[英]installing php_printer on wamp server

Ive been googling around on how to install the php_printer.dll for wamp server, nothing came up.我一直在谷歌上搜索如何为 wamp 服务器安装php_printer.dll ,但没有任何结果。 Perhaps, anyone know how to install that ext?也许,有人知道如何安装那个分机吗? Basically, im trying to use php printer function and i need that extension as i heard.基本上,我正在尝试使用 php printer function 并且我需要那个扩展名。 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?我尝试将 http://www.issociate.de/board/goto/751941/Call_to_undefined_function_printer_open().html安装在 wamp 服务器上,但仍然在网页上显示错误? i added the extension: php_printer.dll in php.ini我在 php.ini 中添加了extension: php_printer.dll php_printer.dll

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.确保php_printer.dll列在 PHP 安装内的“ext”目录下。 If it isn't there, you will need to download that extension and save it under the "ext" directory.如果它不存在,您将需要下载该扩展并将其保存在“ext”目录下。
  2. Add the extension inside of php.ini.在 php.ini 中添加扩展。
  3. Reboot your server and try again.重新启动服务器并重试。

Hope that helps,希望有帮助,
spryno724 spryno724

Not不是

extension: php_printer.dll扩展名:php_printer.dll

You should use你应该使用

extension=php_printer.dll扩展=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.另外,请注意 php_printer.dll 的版本很多,其中大多数在 Windows 平台上不起作用。

Try to get fresh one: pecl-5.2.6-Win32.zip .尝试获得新鲜的: pecl-5.2.6-Win32.zip

Also, consider this line form PHP: Printer manual此外,请考虑此行形式 PHP:打印机手册

Windows users must enable php_printer.dll inside of php.ini in order to use these functions. Windows 用户必须在 php.ini 中启用 php_printer.dll 才能使用这些功能。 A DLL for this PECL extension is currently unavailable.此 PECL 扩展的 DLL 目前不可用。

I've just tried to enable it on Wamp (Windows XP) and it doesn't work.我刚刚尝试在 Wamp (Windows XP) 上启用它,但它不起作用。

see the path for "Loaded Configuration File" in your php info page.请参阅 php 信息页面中“加载的配置文件”的路径。 then add extension=php_printer.dll on that php.ini file.然后在 php.ini 文件中添加 extension=php_printer.dll 。 mine, it was "D:\wamp\bin\apache\apache2.4.4\bin\php.ini" at "Loaded Configuration File" on php info page.我的,它是 php 信息页面上“加载的配置文件”中的“D:\wamp\bin\apache\apache2.4.4\bin\php.ini”。

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添加后,它可能会发出警告,例如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.我也通过更改 Apache、PHP 和 MySQL 的版本解决了这个问题。 correct versions are: PHP 5.2.6 MySQL 5.0.45 Apache 2.2.9正确的版本是: 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.如果您可以使用 xampp 1.6.8 版本,它将解决这些问题。 it has php 5.2.6 and also php_printer.dll file has saved in ext folder in php folder.它有 php 5.2.6 和 php_printer.dll 文件已保存在 php 文件夹的 ext 文件夹中。 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.所以你只需要取消注释 php.ini 文件中的行 extension=php_printer.dll ,该文件在 ZE1BFD762321E409CEE4AC0B6E841963 上的“加载的配置文件”部分下的路径中注意到。 you can find that version of xampp from www.oldapps.com您可以从 www.oldapps.com 找到 xampp 的版本

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()).在您的 ini 中启用 php_printer.dll 后,我首先确保您在良好的 INI 文件中执行此操作(通过查看 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然后,如果加载了正确的 INI,但模块仍然无法工作,我将 go 到命令提示符并尝试手动运行 php,例如
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 .最后 - 您将得到报告的错误很可能是您尝试加载编译为“线程安全”的模块,而您的 PHP 版本被编译为非线程安全 Or it will be the other way around.或者它会反过来。 To overcome that, you'll need to download the proper version of PECL.为了克服这个问题,您需要下载正确版本的 PECL。 I think that the link mentioned earlier by Wh1T3h4Ck5 is the thread-safe one.我认为 Wh1T3h4Ck5 前面提到的链接是线程安全的。
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://museum.php.net/php5/pecl-5.2.6-nts-Win32.zip或者可能在这里,这是一堆win32二进制文件:
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.下载后,从打印机 dll 中取出,复制到 c:\php\ext (或任何你使用的),重置 web 服务器,它应该可以工作。 If it does well, then the php -v shouldn't give errors any more.如果它运行良好,那么php -v不应再出现错误。 You can also use the php -m at that point, to list all the modules loaded, or just check the phpinfo() again.您还可以在此时使用php -m列出所有加载的模块,或者再次检查 phpinfo()。
That was the scenario I had and that's how I solved it.这就是我遇到的情况,这就是我解决它的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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