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. :)
Related
Can the json extension be disabled in PHP? The doc says that:
As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default.
But some people in the comments say that the json extension is sometimes provided as a separate package.
Can the json extension be explicitly disabled, or can we be confident that it's always available?
Background: I want to make a class in a library of mine implement JsonSerializable, but that may be a BC break if the interface is not always declared, and the library suddenly relies on an extension that's not always available.
PHP 8:
No, the JSON extension cannot be disabled anymore.
PHP 7:
Yes, any PHP extension can be installed, uninstalled, enabled, or disabled at will.
The json extension - despite its ubiquity - is still just an extension and can be removed in this way as well.
There are a couple of cases in which the json extension might not exist:
The administrator disabled/uninstalled it:
;extension=json
The version of PHP that was installed was compiled from source manually, and the json extension was left out:
--disable-json
The extension is bundled as a separate package; for example, on Fedora you have to install the php-json package explicitly.
The important part of your question: Can we be confident that it's always available
Normally, I would say no. However unlikely the case is that this particular extension is disabled or left out, it still doesn't mean that it won't happen.
If your intended audience is limited to people who probably wouldn't touch those kinds of settings, then you might be safe, but there's no guarantee.
My suggestion: Build your library as a Composer package, and declare ext-json as a dependency. That way, you can provide installation instructions as a Composer package and if the underlying system doesn't meet your package requirements, the installation will fail and the user will be alerted to the missing extension.
I recently upgraded my Linux server from Apache 2.1 to 2.4 and PHP 5.2 to 5.3. Previously I was using pdf.so from PDFlib fine, but when I tried to install it, as downloaded from here,
http://www.pdflib.com/download/free-software/pdflib-lite-7/
PHP failed to load the module as it was compiled in for PHP 5.3. This install was done using the newest version of PDFlib that I could find, 9.0.2.
Anyone know whether this is possible? I've already got things coded in PHP for PDFlib and prefer not to use another library unless the commands are the same.
UPDATE
Has anyone successfully used PDF Lite with PHP 5.3?
You must compile it. Currently no build is available for PHP 5.3.
On the Download-Site, READ the info:
PDFlib Lite source code must be compiled to generate a usable library. PDFlib GmbH does not offer precompiled (binary) versions of PDFlib Lite.
If you have compile errors, check out the error logs - What say it? Yep, i think you need additional sources for compiling (mostly).
I have created a PHP extension using C++. I want to ship my extension to my clients in its binary form. That means I need to build a separate version of it for each PHP version (5.2, 5.3, 5.4, 5.5) and each processor architecture.
My questions are:
why do they keep updating the API timestamp while the API itself seemingly does not change? Wouldn't it remove a lot of headache while upgrading your system to use the next version of PHP? Just for comparison, I also have a version of my extension for MS Excel using the XLL API and that API has remained backwards compatible since 2003 which allows me to have just two binaries (32 and 64 bit) for all of my clients.
Is there any way around this problem? I.e. is there a way to build a PHP extension that can be run in multiple PHP versions?
Maybe you can try a hybrid approach. Compile your C++ library separately and then create an open source PHP extension wrapper for that. The PHP extension has nearly no logic of its own. It converts data types from PHP to C/C++ back and forth and passes the arguments to functions/methods implemented in your C++ library.
You then just maintain a binary version of your library per platform and the adoption to a particular PHP version is done by the open source PHP extension.
This of course requires that the systems of your customers do have the PHP development packages installed, as well as a compiler.
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.
It seems like PHP have removed dbx-extension as default install since version 5.
I am wondering, why? Is dbx out?
And where can I download the extension, I did google, but I can't find it.
Thank you.
From the PHP manual:
This extension has been moved to the ยป PECL repository and is no
longer bundled with PHP as of PHP 5.1.0.
PDO offers the same sort of functionality (single interface to multiple database types) so I assume you're expected to use that instead.