Is it possible to use PECL extensions in HipHop? - php

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.

Related

How does one build WINCACHE .DLL from source files?

I downloaded WINCACHE-1.3.7.4.tgz from the PECL download page. Unpacking it i find many a C orientated source file. Compiling from source in Linux i have some experience in BUT none at all in Windows (i am running Windows 7).
The instructions on PHP.net's WinCache pages does not seem to match the files extracted from the `.tgz'
I have looked at suggested questions
Creating Windows DLL from C++ source files
Creating php DLL from pecl source files
but i have NO idea where to actually start off.
And thus, does anyone know how i would build WinCache .DLL from the provided source? (if at all easily possible)
Do you really need to build this extension from source? If not, you can download precompiled DLLs here. If yes, you have to follow this tutorial for compiling PHP extension on Windows. Basically, you have to build PHP and it will also compile extension that you will enable. After successful compilation you should be able to find required dll and use it with your running PHP.
But another question is for what do you need it? What version of PHP do you use? If 5.5+ you should consider OPCache instead WinCache.
Since the Zend Opcache extension is now in the core PHP product, the WinCache opcode cache is disabled by default. As of PHP 5.5, the opcode cache portion of WinCache is deprecated, and will be removed in a future release of the WinCache extension.

Minimum requirements to compile a PHP extension

I have the source for a PHP extension, and the compiled version for PHP 5.3. But I have PHP 5.4, and the project appears to have been abandoned.
So given the source code, what is the minimum I have to do to compile it for PHP 5.4?
EDIT Note: I'm on Windows.
It depends on the extension itself. If the extension requires some other libraries, like, say the mysql extension, then you also need the mysql client library - the C API. Why? Because you explicitly stated that you want minimal dependency requirements. If the extension does not require any other libraries, you can nicely open those C files that you already have, and compile it using any available C compiler. Naturally, you will need PHP development kit as well. :)

What are differences between PECL and PEAR?

I can see that GD library is for images. But I can't see differences between PECL and PEAR.
Both have authentication.
What are the main differences between two?
Why don't they combine them?
PECL stands for PHP Extension Community Library, it has extensions written in C, that can be loaded into PHP to provide additional functionality. You need to have administrator rights, a C compiler and associated toolchain to install those extensions.
PEAR is PHP Extension and Application Repository, it has libraries and code written IN php. Those you can simply download, install and include in your code.
So, yes they are similar, but yet so different :)
PECL is a repository of C extensions for PHP. Those extensions are usually installed via the pecl command, which is an alias for pear, with the default channel/repository set to pecl.php.net.
PEAR is multiple things:
The package installer (pear command) that is able to install packages from different channels (repositories), including pecl.php.net. Many consider composer the successor of the pear installer.
The package repository http://pear.php.net/packages.php with ~600 libraries. Many of them are composer-installable.
A PHP coding standard that is available with PHP_CodeSniffer.
pear is a php classes written in php
Whereas pecl is extensions which not written in php and need compiling .
PEAR as-such is not a coding standard. Instead PEAR "follows" a set coding standard that is encouraged within the PHP Community. This is however not the only coding standard that PHP users can follow, the ZF, for eg. recommends a slightly different standard.
PEAR is also a coding standard ;-)
php_codesniffer (install via $pear install php_codesniffer ) is a tool that will scan your code and hilight where it deviates from that or any other supported coding standard.
From my understanding, PHP has modules and frameworks, both being its libraries, external modules, called extensions, live in its PECL repository, while frameworks, called packages, live in its PEAR repository.
One can use PEAR packages within PHP code by simply sourcing the source code files, but PECL extensions should be installed on the system and enabled in configuration files to link to the interpreter.
Also, PEAR packages are written in PHP and are plain-text scripts, while PECL extensions are written in C/C++ and are compiled binaries in their consummable form.
Extensions as the name suggest extend PHP with something it doesn't offer by itself yet, while packages are just a collection of PHP code, ie. everything you can do with PHP proper.
This is parallel to Perl's PM modules and XS extensions.
That said, my view may not be 100% accurate, but that's how I could settle this in my mind :-)

Building PECL extension on windows

I want to build an old version of APC on windows. They say (check the link)
A DLL for this PECL extension is currently unavailable. See also the building on Windows section.
but the guides referred are not available. Can you recommend a How-to?
Well, I tried this last night and I also needed to download the PHP sourcefiles, Zlib source, and OpenSSL source, and build Zlib and openSSl static libraries to get all the references. But then once I had all the references squared aware the darn thing still errored on the build because something was redefined.
And I know what you mean, this process is not documented at all. Personally I don't think there is a windwows DLL to download because they couldn't get it to build either.

PECL extension for Windows

I found a few related posts here but didn't get my answer. So posting again.
How would I install a PECL extension on windows? Say I want the PECL oAuth extension on Windows XP.
I know 2 methods, but none of them is working for me.
The site http://pecl4win.php.net/ is down for months. So I cant download the DLL. Is there any place we can download the DLLs from ?
running the command
pecl install oauth-0.99.9.tgz is throwing the error
The DSP oauth.dsp does not exist.
I tried with few other extensions also and getting the same error.
What am I missing here?
Releases can now be found here:
http://windows.php.net/downloads/pecl/releases/
If you need an extension not available there you might ask on the pecl-dev at lists.php.net mailing list.
I got what I am looking for in http://windows.php.net/downloads/pecl/releases/
Currently PECL for windows is in an odd reformation state. The reason being that I believe they are trying to provide VS2008 source versions. I would actually suggest using Zend Server for now until the windows half of the php group gets everything fixed up. Zend Server includes almost all of the extensions that you can find in PECL, and everything else, if you are lucky, you could find an compile yourself.
The PECL installer downloads the source code of the extension and tries to compile it with your local C compiler. The problem is that the whole process is designed for Unix systems, where a C compiler is available or can be easily installed. Setting an environment to compile C code under Windows is pretty complicate.
The ideal solution is getting a DLL file that someone already compiled. That's what the pcle4win site was for. However, there's currently no official repository to download PECL DLLs so you only have two alternatives:
Find an unofficial DLL somewhere in Google
Compile it yourself (another link) with Microsoft Visual Studio
It'd be cool that there was a DLL repository out there but I'm unaware of any.
The php source ships with a set of configuration scripts for windows (using windows script host) that mimics the autoconf tools as far as php is concerned. If you place the code for the extension in a directory under the /ext directory (where all the other extensions like bcmath, bzip, ... are located) you can let the buildconf-script create a makefile that includes the build rules for that (new) extension.
There's a step-by-step walk-through at http://wiki.php.net/internals/windows/stepbystepbuild which seems to be brief but feasible.
compiled oauth: http://windows.php.net/downloads/pecl/releases/oauth/
another pecl extension: http://windows.php.net/downloads/pecl/releases/

Categories