Fatal error: Call to undefined function printer_open()

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Fatal error: Call to undefined function printer_open()

Postby vijayk » 09. April 2010 09:13

hi all,

I am writing the below PHP code to print the job automatically, when i run PHP program.

<?php
$filename = "test.php";
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
$handle = "Phaser 5550DN PS";
$handle = printer_open();
printer_set_option($handle, PRINTER_MODE, "raw");
printer_write($handle,$contents);
printer_close($handle);
?>

But, the above code giving error "Fatal error: Call to undefined function printer_open() in C:\xampp\htdocs\xampp\printtest.php on line 8" .

since, i am new to PHP, pls help me get work.

thanks
rgs
vijay
vijayk
 
Posts: 3
Joined: 09. April 2010 09:04

Re: Fatal error: Call to undefined function printer_open()

Postby MC10 » 09. April 2010 23:23

printer_open() is not a valid function; you can't use PHP to actually print something from a printer.
MC10
 
Posts: 148
Joined: 20. February 2010 20:13

Re: Fatal error: Call to undefined function printer_open()

Postby Altrea » 09. April 2010 23:30

MC10 wrote:printer_open() is not a valid function; you can't use PHP to actually print something from a printer.

printer_open()
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8299
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Fatal error: Call to undefined function printer_open()

Postby MC10 » 09. April 2010 23:32

Okay, my bad, it just seems unlikely for a PHP script to allow printing; an evil site could make your printer start printing random things at random times.

From http://www.php.net/manual/en/printer.installation.php:
php.net wrote:This PECL extension is not bundled with PHP.

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. See also the building on Windows section.


XAMPP does not include the .dll, so the functions are not defined.
MC10
 
Posts: 148
Joined: 20. February 2010 20:13

Re: Fatal error: Call to undefined function printer_open()

Postby Narrowboyy » 10. April 2010 00:48

The last XAMPP version that included the php_printer.dll was 1.7.1 (the corresponding extension in the C:\xampp\php\php.ini file has to be uncommented to use it).

So if you still want to use this function until there is an official upgrade released then you would have to install XAMPP 1.7.1 version from the SourceForge Repository.

Note and personal comment only.
As far as I am personally concerned 1.7.1 was the last good XAMPP release, as versions after this appear to have many issues that have not been adequately documented or addressed by the current (sloppy) XAMPP for Windows development team, with the current 1.7.3 being the absolute worst release so far - the volume of 1.7.3 issues on this forum would seem to testify this observation.

Perhaps the solution would be for a wider range of knowledgeable XAMPP beta testers to really give these intended new release a thorough work out.
Narrowboyy
 
Posts: 64
Joined: 16. February 2009 02:56

Re: Fatal error: Call to undefined function printer_open()

Postby vijayk » 12. April 2010 11:03

hi all

I tried few methods like i.adding 'php_printer.dll ' in PHP.ini file ii. add the ddl in script. but doesnt work. if you give anyworkable solutions, it will help lot.
thanks
rgs
vijay
vijayk
 
Posts: 3
Joined: 09. April 2010 09:04

Re: Fatal error: Call to undefined function printer_open()

Postby Nobbie » 12. April 2010 14:03

vijayk wrote:I tried few methods like i.adding 'php_printer.dll ' in PHP.ini file ii. add the ddl in script. but doesnt work.


This helps only if you have a valid copy of php_printer.dll on your hard disk (in the extensions folder of PHP). Did you find that DLL on your PC?
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04

Re: Fatal error: Call to undefined function printer_open()

Postby vijayk » 13. April 2010 08:01

Hi Nobbie
Yes. am able to see the dll in 'c:\xampp\php' directory. But, its not working.
thanks
vijayk
 
Posts: 3
Joined: 09. April 2010 09:04

Re: Fatal error: Call to undefined function printer_open()

Postby Nobbie » 13. April 2010 10:33

vijayk wrote:Yes. am able to see the dll in 'c:\xampp\php' directory.


That's the wrong location, extension should be stored in c:\xampp\php\ext and not in c:\xampp\php - did you put it there? Move it to the ext-folder, and restart Apache. You should also look into the error_log, which tells you, if it fails to load the module. You should also run a phpinfo(), which shows up all loaded modules, you must find the printer extensions there.
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 55 guests