Dbaker Posted April 3, 2013 Share Posted April 3, 2013 My Knowledge base is; I can get around in php, I have never worked with C, C++, C# or any compilers. 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 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. I upgraded because I needed a newer version of Apache and MySQL for security reasons. I do not have the option to downgrade. I use the php_printer.dll for the ability to print raw data to the printer: printer_set_option($handle, PRINTER_MODE, "RAW"); My Code worked fine in PHP 5.3 but broke in PHP 5.4. 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 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 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 It took me all day but the PHP build worked. But then tried to create the php_printer.dll following the dbase example. First I tried : svn co http://svn.php.net/repository/pecl/printer/trunk pecl/printer But it said: 'svn' is not recognized as an internal or external command, operable program or batch file. So I just downloaded the files myself from: svn.php.net/repository/pecl/printer/trunk/ and put them in: C:\php-sdk\php54dev\vc9\x86\php5.4-201303311430\ext\printer The files: config.w32 CREDITS.txt php_printer.h printer.c printer.dsp printer.php Tried it both With printer.php and with out. I made sure to download the libraries both from: windows.php.net/downloads/php-sdk/deps/vc9/x86/ Also just the deps file: deps-5.4-vc9-x86.7z I tried the deps file alone and then added the other, however; every time I received the following when I tried to nmake: c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430>nmake Microsoft (R) Program Maintenance Utility Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. printer.c ext\printer\printer.c(266) : error C2065: 'pval' : undeclared identifier ext\printer\printer.c(266) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(266) : error C2100: illegal indirection ext\printer\printer.c(266) : warning C4552: '*' : operator has no effect; expect ed operator with side-effect ext\printer\printer.c(267) : error C2275: 'printer' : illegal use of this type a s an expression c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430\ext\printer\php_printer. h(78) : see declaration of 'printer' ext\printer\printer.c(267) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(269) : error C2143: syntax error : missing ';' before 'typ e' ext\printer\printer.c(271) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(271) : warning C4047: '=' : 'int' differs in levels of ind irection from 'printer *' ext\printer\printer.c(272) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(272) : error C2223: left of '->dmModifiedFields' must poin t to struct/union ext\printer\printer.c(274) : error C2065: 'argc' : undeclared identifier ext\printer\printer.c(274) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : error C2224: left of '.type' must have struct/union type ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : warning C4047: 'function' : 'zval *' differs in lev els of indirection from 'int' ext\printer\printer.c(275) : warning C4024: 'zval_isref_p' : different types for formal and actual parameter 1 ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : warning C4047: 'function' : 'zval *' differs in lev els of indirection from 'int' ext\printer\printer.c(275) : warning C4024: 'zval_refcount_p' : different types for formal and actual parameter 1 ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : warning C4047: 'function' : 'zval *' differs in lev els of indirection from 'int' ext\printer\printer.c(275) : warning C4024: 'zval_delref_p' : different types fo r formal and actual parameter 1 ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : error C2223: left of '->value' must point to struct /union ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : error C2224: left of '.type' must have struct/union type ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : warning C4047: '=' : 'int' differs in levels of ind irection from 'zval *' ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : error C2223: left of '->type' must point to struct/ union ext\printer\printer.c(275) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(275) : error C2100: illegal indirection ext\printer\printer.c(275) : warning C4047: 'function' : 'zval *' differs in lev els of indirection from 'int' ext\printer\printer.c(275) : warning C4024: '_convert_to_string' : different typ es for formal and actual parameter 1 ext\printer\printer.c(276) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(276) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(276) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(276) : error C2100: illegal indirection ext\printer\printer.c(276) : error C2100: illegal indirection ext\printer\printer.c(276) : error C2224: left of '.value' must have struct/unio n type ext\printer\printer.c(278) : error C2065: 'argc' : undeclared identifier ext\printer\printer.c(279) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(279) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(285) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(285) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(285) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(285) : error C2223: left of '->handle' must point to struc t/union ext\printer\printer.c(285) : error C2198: 'OpenPrinterA' : too few arguments for call ext\printer\printer.c(286) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(286) : error C2223: left of '->pi2' must point to struct/u nion ext\printer\printer.c(287) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(287) : error C2223: left of '->pi2' must point to struct/u nion ext\printer\printer.c(287) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(287) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(287) : error C2198: 'DocumentPropertiesA' : too few argume nts for call ext\printer\printer.c(288) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(288) : error C2223: left of '->handle' must point to struc t/union ext\printer\printer.c(288) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(288) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(288) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(288) : error C2223: left of '->pi2' must point to struct/u nion ext\printer\printer.c(288) : warning C4047: 'function' : 'LPSTR' differs in leve ls of indirection from 'int' ext\printer\printer.c(288) : warning C4024: 'DocumentPropertiesA' : different ty pes for formal and actual parameter 3 ext\printer\printer.c(288) : error C2198: 'DocumentPropertiesA' : too few argume nts for call ext\printer\printer.c(289) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(289) : error C2223: left of '->info' must point to struct/ union ext\printer\printer.c(290) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(290) : error C2223: left of '->info' must point to struct/ union ext\printer\printer.c(291) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(291) : error C2223: left of '->info' must point to struct/ union ext\printer\printer.c(292) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(292) : error C2223: left of '->info' must point to struct/ union ext\printer\printer.c(293) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(293) : error C2223: left of '->info' must point to struct/ union ext\printer\printer.c(293) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(293) : error C2223: left of '->info' must point to struct/ union ext\printer\printer.c(294) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(294) : error C2223: left of '->dc' must point to struct/un ion ext\printer\printer.c(294) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(294) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(294) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(294) : error C2223: left of '->pi2' must point to struct/u nion ext\printer\printer.c(294) : error C2198: 'CreateDCA' : too few arguments for ca ll ext\printer\printer.c(295) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(295) : warning C4022: 'zend_register_resource' : pointer m ismatch for actual parameter 2 ext\printer\printer.c(299) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(299) : error C2223: left of '->name' must point to struct/ union ext\printer\printer.c(310) : error C2065: 'pval' : undeclared identifier ext\printer\printer.c(310) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(310) : error C2100: illegal indirection ext\printer\printer.c(310) : warning C4552: '*' : operator has no effect; expect ed operator with side-effect ext\printer\printer.c(311) : error C2275: 'printer' : illegal use of this type a s an expression c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430\ext\printer\php_printer. h(78) : see declaration of 'printer' ext\printer\printer.c(311) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(313) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(317) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(317) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(317) : warning C4047: 'function' : 'zval **' differs in le vels of indirection from 'int' ext\printer\printer.c(317) : warning C4024: 'zend_fetch_resource' : different ty pes for formal and actual parameter 1 ext\printer\printer.c(317) : warning C4047: '=' : 'int' differs in levels of ind irection from 'printer *' ext\printer\printer.c(317) : error C2065: 'resource' : undeclared identifier ext\printer\printer.c(319) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(319) : error C2100: illegal indirection ext\printer\printer.c(319) : error C2100: illegal indirection ext\printer\printer.c(319) : error C2224: left of '.value' must have struct/unio n type ext\printer\printer.c(319) : warning C4047: 'function' : 'int' differs in levels of indirection from 'void ***' ext\printer\printer.c(319) : warning C4024: '_zend_list_delete' : different type s for formal and actual parameter 1 ext\printer\printer.c(319) : error C2198: '_zend_list_delete' : too few argument s for call ext\printer\printer.c(328) : error C2065: 'pval' : undeclared identifier ext\printer\printer.c(328) : error C2065: 'arg1' : undeclared identifier ext\printer\printer.c(328) : fatal error C1003: error count exceeds 100; stoppin g compilation NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\ VC\Bin\cl.exe"' : return code '0x2' Stop. If some one is set up to compile this DLL for 5.4.7 I would greatly appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/276485-php-startup-printer-unable-to-initialize-module/ Share on other sites More sharing options...
Dbaker Posted April 4, 2013 Author Share Posted April 4, 2013 (edited) I got a little help from someone at another forum. Hello, Open 'printer.c' and replace all instances of 'pval' with 'zval' and it should compile. Thank you Hackattack, one step closer I hope, c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430>buildconf ~ c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430>configure --disable-all --enable-cli --enable-printer ~ c:\php-sdk\php54dev\vc9\x86\php5.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_TS\php5ts.lib and object Release_TS\php5ts.exp Creating library Release_TS\php.lib and object Release_TS\php.exp SAPI sapi\cli build complete 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. In the Release_TS\ext folder there is a folder named Printer. It contains the following Files: printer.obj printer.sbr vc90.idb I also did the last step: c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430>cd Release_TS c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430\Release_TS>php -m [php Modules] Core date ereg pcre printer Reflection SPL standard [Zend Modules] c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430\Release_TS> Edited April 4, 2013 by Dbaker Quote Link to comment https://forums.phpfreaks.com/topic/276485-php-startup-printer-unable-to-initialize-module/#findComment-1422951 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.