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

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().

Related

how to use --without-sqlite3 at compile time in php?

I was reading PHP documentation about how to disable the SQLite3 extension in PHP:
The SQLite3 extension is enabled by default as of PHP 5.3.0. It's possible to disable it by using --without-sqlite3 at compile time.
but i didn't realize how to use --without-sqlite3 ?
"Compile time" refers to when someones takes the PHP source code, and compiles it into binary files. Once PHP is installed from those binaries, there is no way to disable an extension that was included in the PHP binary. (You can disable extensions that are compiled into separate binaries, but that is not the case for the SQLite3 extension for PHP. So in order to disable SQLite3 in your PHP, you'd need to obtain the source code of PHP, and compile it manually; it's not an easy task, if you've never compiled something, but I'm sure there are walkthroughs you can find online, if you really need.

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.

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

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.

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.

Is it possible to use PECL extensions in HipHop?

I have an application which uses rabbit mq broker and I have consumers written on php and use this extension http://pecl.php.net/package/amqp. I would like to compile these consumers using hiphop but amqp extension is not supported in hiphop. So the question is could I compile PECL extensions into hiphop?
Thanks in advance
You would have to manually write a HipHop extension in C++ to interface with the extension's functionality. Most likely the original PHP extension is of little use, if it merely wraps a C library anyway. See the answers on this thread for an explanation of what the differences between HipHop and PHP extensions are: https://groups.google.com/group/hiphop-php-dev/browse_thread/thread/51184984d948a77b
I started the HHVM-AMQP project http://github.com/akalend/hhvm-amqp The base of the pecl/amqp is present, but exist the difference. See examples directory. It is developer version.

Categories