PHP 5.4.7 编译 ext php_printer

2022-01-04 00:00:00 dll compilation printing php

我的知识库是,我可以使用 php.我从未使用过 C、C++、C# 或任何编译器.

My Knowledge base is, I can get around in php. I never worked with C, C++, C# or any compilers.

我从使用 php 5.3 的 XAMPP 1.7.3 升级到 1.8.1,其中包括:阿帕奇 2.4.3MySQL 5.5.27PHP 5.4.7

I Upgraded from XAMPP 1.7.3, which used php 5.3, to 1.8.1 which includes: Apache 2.4.3 MySQL 5.5.27 PHP 5.4.7

它正在安装在 Windows 7 Pro、Windows XP Pro 和 Windows Server 2008 r2 上.但我目前正试图让它在 Windows 7 上运行.

It is being installed on Windows 7 Pro, Windows XP Pro and Windows Server 2008 r2. But I am trying to get it to working on Windows 7 currently.

我升级是因为出于安全原因我需要更新版本的 Apache 和 MySQL.我没有降级的选项.

I upgraded because I needed a newer version of Apache and MySQL for security reasons. I do not have the option to downgrade.

我使用 php_printer.dll 来将原始数据打印到打印机:

I use the php_printer.dll for the ability to print raw data to the printer:

printer_set_option($handle, PRINTER_MODE, "RAW");

我的代码在 PHP 5.3 中运行良好,但在 PHP 5.4 中崩溃了.

My Code worked fine in PHP 5.3 but broke in PHP 5.4.

收到错误后:致命错误:调用~中未定义的函数printer_open()".我查看了php_error_log,收到如下信息.

After receiving the error: " Fatal error: Call to undefined function printer_open() in ~". I checked the php_error_log and received the following information.

PHP Warning: PHP Startup: printer: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match

我找了几个小时试图为 PHP 5.4.7 找到一个预编译的 php_printer.dll 无济于事.我已经得出结论,我必须从 PECL 中的源文件编译它.pecl.php.net/package/printer

I've looked for hours trying to find a pre-compiled php_printer.dll for PHP 5.4.7 to no avail. I have concluded that I will have to compile it from source files in the PECL. pecl.php.net/package/printer

在我做任何互联网用户应该做的事情之前,我从来没有这样做过.我用谷歌搜索并在这里找到了一些信息:https://wiki.php.net/internals/windows/stepbystepbuild

Having never had to do this before I did what any internet user should do. I googled it and found some information here: https://wiki.php.net/internals/windows/stepbystepbuild

我花了一整天,但 PHP 构建成功了.但随后尝试创建 php_printer.dll首先我试过:

It took me all day but the PHP build worked. But then tried to create the php_printer.dll First I tried :

svn co http://svn.php.net/repository/pecl/printer/trunk pecl/printer

但它说:'svn' 不是内部或外部命令,也不是可运行的程序或批处理文件.

But it said: 'svn' is not recognized as an internal or external command, operable program or batch file.

所以我自己从以下位置下载了文件:svn.php.net/repository/pecl/printer/trunk/并将它们放入:C:php-sdkphp54devvc9x86php5.4-201303311430extprinter

So I just downloaded the files myself from: svn.php.net/repository/pecl/printer/trunk/ and put them in: C:php-sdkphp54devvc9x86php5.4-201303311430extprinter

我确保从以下位置下载库:windows.php.net/downloads/php-sdk/deps/vc9/x86/也只是:deps-5.4-vc9-x86.7z

I made sure to download the libraries both from: windows.php.net/downloads/php-sdk/deps/vc9/x86/ Also just the: deps-5.4-vc9-x86.7z

然而,我尝试了一个然后另一个;每次我尝试 nmake 时收到以下信息:

I tried one then the other, however; every time I received the following when I tried to nmake:

c:php-sdkphp54devvc9x86php5.4-201303311430>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

printer.c
extprinterprinter.c(266) : error C2065: 'pval' : undeclared identifier

<小时>

更新

我在另一个论坛上得到了一些帮助.

I got some help on another forum.

by hackattack142 » 2013 年 4 月 3 日 23:51

by hackattack142 » 03. April 2013 23:51

你好

打开'printer.c'并将'pval'的所有实例替换为'zval',它应该可以编译.

Open 'printer.c' and replace all instances of 'pval' with 'zval' and it should compile.

感谢 Hackattack,我希望更近一步,

Thank you Hackattack, one step closer I hope,

c:php-sdkphp54devvc9x86php5.4-201303311430>buildconf
~
c:php-sdkphp54devvc9x86php5.4-201303311430>configure --disable-all --enable-cli 
--enable-printer
~
c:php-sdkphp54devvc9x86php5.4-201303311430>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

internal_functions.c
printer.c
   Creating library Release_TSphp5ts.lib and object Release_TSphp5ts.exp
   Creating library Release_TSphp.lib and object Release_TSphp.exp
SAPI sapicli build complete

好像编译好了.然而;我找不到printer.dll 或php_printer.dll,这是我希望的结果.

It seemed to have compiled. However; I can't find a printer.dll or a php_printer.dll which is the outcome I was hoping for.

在Release_TSext 文件夹中有一个名为打印机 的文件夹.它包含以下文件:打印机.obj打印机.sbrvc90.idb

In the Release_TSext folder there is a folder named Printer. It contains the following Files: printer.obj printer.sbr vc90.idb

我也做了最后一步:

c:php-sdkphp54devvc9x86php5.4-201303311430>cd Release_TS
c:php-sdkphp54devvc9x86php5.4-201303311430Release_TS>php -m
[PHP Modules]
Core
date
ereg
pcre
printer
Reflection
SPL
standard
[Zend Modules]
c:php-sdkphp54devvc9x86php5.4-201303311430Release_TS>

<小时>

来自其他论坛的帮助


Help from another forum

configure --disable-all --enable-cli --enable-printer=shared

它起作用了,但是当我尝试使用它时,我创建了 php_printer.dll:

It worked and i created the php_printer.dll however when i tried to use it:

在 PHP 错误日志中:[2013 年 4 月 15 日 15:34:53 UTC] PHP 警告:PHP 启动:无效的库(可能不是 PHP 库)'php_printer.dll' in Unknown on line 0

In PHP Error Log: [15-Apr-2013 15:34:53 UTC] PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'php_printer.dll' in Unknown on line 0

我使用 5.4.15 时不得不抓取 5.4.7 文件,但 XAMPP 1.8.1 使用 5.4.7

I had to grab 5.4.7 files as I was using 5.4.15 but XAMPP 1.8.1 uses 5.4.7

http://www.oldapps.com/php_programming_language.php?old_php=8227

并放入:C:php-sdkphp54devvc9x86php-5.4.7

And put it in: C:php-sdkphp54devvc9x86php-5.4.7

然后将打印机文件放在ext文件夹中并完成上述所有过程并:

then put the printer files in the ext folder and did all the above processes and:

配置 --enable-printer=shared

configure --enable-printer=shared

它奏效了:

PHP 5.4.7 版 php_printer.dll

http://pylonx.com/PHP/php_printer_5.4.7.zip

推荐答案

下载并安装您喜欢的任何版本的 php,并在此处安装相应的 php 打印机 dll:http://windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/

Download and install any version of php you like and install the appropriate php printer dll here: http://windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/

相关文章