我想用PHP打印到服务器端打印机。我发现了类似的示例代码,它们大多都使用相同的API函数来执行此任务。当我在我的服务器上运行它来测试它所说的代码时“PHP致命错误:调用未定义的函数printer_open()”。所以我发现至少有三种不同版本的php_printer.DLL的这个打印机功能,并单独尝试它们。我做了一些调查研究,寻找到Apache服务器错误日志中发现了这个警告PHP打印到服务器端打印机
PHP的警告:PHP启动:无法加载动态库中,“ext \ php_printer.dll” - 指定的模块找不到\ r \ n在未知在线0
从此发现了一些Bing搜索结果是说,当Apache启动时,它没有加载的原因是因为它是依赖于其他库。如果这是真的,我还没有能够找到哪些库DLL是这些,以及从哪里得到它们。这是我首先需要帮助,基本知道它是否不依赖,那么为什么会抛出PHP警告或者我需要什么库。
感谢所有帮助
ZAC
我运行wampserver2.2
的Apache 2.4.2
PHP 5.4.3
操作系统:Windows 7 64位
已添加到php.ini文件
延长= php_printer.dll
,并在php日志中没有错误
也是我每次我改变php.ini文件的时间重新启动服务器,或者当我把一个新的DLL在*分机*目录 我甚至在windows的环境变量中放入了wamp DLL的“... \ ext \”路径,就像在黑暗中拍摄一样。
实施例代码
/* get the sample text */
$lipsum = "test print";//file_get_contents('lipsum.txt');
phpinfo();
/* open a connection to the printer */
$printer = printer_open("Microsoft XPS Document Writer");
/* write the text to the print job */
printer_write($printer, $lipsum);
/* close the connection */
printer_close($printer);
?>
3月19日修订
我发现与来自PHP错误日志稍微不同的错误消息一起网站。 基本上下面的链接表示发生错误,因为PHP_printer.dll符合不同的Visual Studio C++版本,因此需要重新编译。它给了我还在特林大部分的步骤,以得到它的工作
PHP的错误:
[18-Mar- 22:55:56 UTC] PHP Warning: PHP Startup: printer: Unable to initialize module Module compiled with module API=1212 PHP
compiled with module API=0525 These options need to match in Unknown on line 0
-02-24
Zac O
+1
检查:/questions/5833223/installing-php-printer-on-wamp-server –
-02-24 00:11:15
+0
您可以使用[的Dependency Walker(HTTP: ///)找到什么dll丢失 –
-02-24 00:39:04
+0
谢谢cchacholiades和lashane我一直在寻找你的建议我会让你们都知道这个兔子洞引导我。 –
-02-25 05:29:37
如果觉得《php文件打印服务器 PHP打印到服务器端打印机》对你有帮助,请点赞、收藏,并留下你的观点哦!