Are PHP extensions just "shell cases" for real libraries? - php

If this is true and PHP extensions run shell commands in the background, why not just use shell_exec instead? Would there be any difference? I'm under the impression that PHP extension are usually written by newbs because they are full of bugs. For example the imagick extension :/ So why not communicate with the library directly?

No, absolutely not. Most PHP extensions interface directly with a C library, and imagick is no exception.
The shoddiness of the imagick extension is entirely the fault of the ImageMagick library itself.

Related

what is meant by extension and binary file of a library?

This is more of a general question but for reference, I read statements like: "Most of the shared hosting providers do not compile imagick extension with PHP, but imagick binaries will be available". I don't know what is meant by "imagick extension" and "imagick binaries"? To me, any non-txt file is a binary. Also, when we install a library like "imagick", are both these kinds of version installed? And what is the difference between them?
"Imagick extension" is the optional component of PHP that adds Imagick-related functions to the language.
"binaries" means programs that are compiled to machine code, as opposed to source code or scripts.
So they're saying that you won't be able to use the built-in Imagic functions in PHP, but you could execute the external programs using methods like shell_exec().

What is the difference between using ffmpeg-php extension and FFmpeg binaries with PHP?

As the subject implies ..
What is the difference between the library in this link
http://ffmpeg.zeranoe.com/builds/
and the php-ffmpeg extension which we install it on wamp (for example).
It isn't complicated. One is simply a standalone FFmpeg binary that you can run from a terminal or other application. The PHP extension version is... a PHP extension.
If you were to use regular FFmpeg binaries, you could use PHP's exec() to run them, like you would run any external application.
Alternatively by using the PHP extension, you get extra functions within PHP itself that you can call to run FFmpeg functionality. It's a native binding that may also be more efficient.
Personally, I recommend going the route of a regular FFmpeg binary for portability. I've found that building the PHP extension is difficult, and almost nobody has it installed. On the other hand, it's very easy to find an FFmpeg binary so you don't have to build it yourself, and it isn't difficult to handle its STDIO streams depending on what you need to do.

Is it possible to access a local printer using TCP/IP sockets in PHP?

I know that PHP has it's own PECL to do this, but I'm currently using PHP 5.4 and the php_printer.dll isn't compiled for this version.
PECL can have some old stuff on there, php_printer.dll is all but deprecated.
Also, as PHP is a scripting language, it's incredibly difficult to gain access to hardware functions (like a printer) directly.
You are best off finding or writing printer access functions in something like C++, and running the script using system(); .
Best of luck!
Printing directly from PHP over TCP/IP sockets requires huge amount of work especially on windows environment without Printer extension or a nice library.
From the documentation:
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.
So, you can try to download php_printer.dll precompiled binary for PHP 5.3 from http://downloads.php.net/pierre/ and use that. Probably it will work with PHP 5.4 too. If not, you should compile PHP from source to use windows Printer extension.

php path to gd library

I am trying to use Codeigniter's image manipulation class which of course requires a php image library.
I know I have gd library enabled on my server from running phpinfo();
However, I need to specify the path to the image library in codeigniter, and I don't know where it is installed! The server is under someone else's jurisdiction, so is there any way at all to find out where the gd library is installed without using the command line? It is a linux server.
Thanks.
GD is compiled with PHP, and is used internally, there is no need to supply a path for GD what so ever, on CI's Manual it states:
library_path : Sets the server path to your ImageMagick or NetPBM library. If you use either of those libraries you must supply the path.
Hint: you are not using ImageMagick or NetPBM
If you mean ImageMagick, you can locate the binaries you can try the following command:
locate imagemagick
but they are usually located in /usr/bin or /usr/X11R6/bin/
did you try phpinfo();
you will get the path to where php installed.
if you can access server
try to search for gd.so
http://www.linuxquestions.org/questions/linux-newbie-8/gd-library-path-145032/
http://php.net/manual/en/image.installation.php

How to enable soap extensions

Is it possible to enable soap extensions in php without compiling the php dist? I´m using Mac OS X 10.5+ with the built in php interpreter.
If you really don't want to compile it you can use NuSoap from PEAR.
But I'd compile it if I were you, nusoap is not compatible with the built-in soap and it's a pain to juggle. Just do it right and start with the PHP5 SOAP lib.
Alan
As far as i know, you need to compile it because it's a core function. But you could try to copy precompiled php packages over your existing ones to put the compiled soap binaries and it's loading informations into the propriate files. Don't forget to make a backup!

Categories