Now that you know how to compile PHP itself, we’ll move on to compiling additional extensions. We’ll discuss how thebuild process works and what different options are available.
Keygen is a PHP package that generates random character sequences known as keys. The package ships with built-in key generators for four key types namely: numeric, alphanumeric, token and byte. Its implementation effectively combines simplicity and expressiveness. PHPMaker Serial Key PHPMaker Crack 2020 is a good and powerful software that came up to make life easier for PHP designers. With it, you can create vibrant websites, allowing users to improve, create, view, and even add documents. Download Persian PHPMaker Extensions for free. Development extensions for PHPMaker. RTL CKEditor v4.9.2 for PHPMaker 2018 CheckFileUpload v2.0 for PHPMaker 2018 Hijri-Shamsi JSCalendar v1.6 for PHPMaker 2018 CKFinder FileManager v2.6.2 for PHPMaker 2018 RTL CKEditor v4.7.1 for PHPMaker 12 CheckFileUpload v1.0 for PHPMaker 12 Hijri-Shamsi JSCalendar v1.6 for PHPMaker 12 CKFinder FileManager v2.
Loading shared extensions¶
As you already know from the previous section, PHP extensions can be either built statically into the PHP binary, orcompiled into a shared object (
.so
). Static linkage is the default for most of the bundled extensions, whereasshared objects can be created by explicitly passing --enable-EXTNAME=shared
or --with-EXTNAME=shared
to./configure
.While static extensions will always be available, shared extensions need to be loaded using the
extension
orzend_extension
ini options. Both options take either an absolute path to the .so
file or a path relative tothe extension_dir
setting.As an example, consider a PHP build compiled using this configure line:
In this case both the opcache extension and GMP extension are compiled into shared objects located in the
modules/
directory. You can load both either by changing the extension_dir
or by passing absolute paths:During the
makeinstall
step, both .so
files will be moved into the extension directory of your PHP installation,which you may find using the php-config--extension-dir
command. For the above build options it will be/home/myuser/myphp/lib/php/extensions/no-debug-non-zts-MODULE_API
. This value will also be the default of theextension_dir
ini option, so you won’t have to specify it explicitly and can load the extensions directly:This leaves us with one question: Which mechanism should you use? Shared objects allow you to have a base PHP binary andload additional extensions through the php.ini. Distributions make use of this by providing a bare PHP package anddistributing the extensions as separate packages. On the other hand, if you are compiling your own PHP binary, youlikely don’t have need for this, because you already know which extensions you need.
Keygen Php Maker Extensions Tool
As a rule of thumb, you’ll use static linkage for the extensions bundled by PHP itself and use shared extensions foreverything else. The reason is simply that building external extensions as shared objects is easier (or at least lessintrusive), as you will see in a moment. Another benefit is that you can update the extension without rebuilding PHP.
Note
If you need information about the difference between extensions and Zend extensions, you may have alook at the dedicated chapter.
Installing extensions from PECL¶
PECL, the PHP Extension Community Library, offers a large number of extensions for PHP. When extensions are removedfrom the main PHP distribution, they usually continue to exist in PECL. Similarly many extensions that are now bundledwith PHP were previously PECL extensions.
Unless you specified
--without-pear
during the configuration stage of your PHP build, makeinstall
will downloadand install PECL as a part of PEAR. You will find the pecl
script in the $PREFIX/bin
directory. Installingextensions is now as simple as running peclinstallEXTNAME
, e.g.:This command will download, compile and install the APCu extension. The result will be a
apcu.so
file in yourextension directory, which can then be loaded by passing the extension=apcu.so
ini option.While
peclinstall
is very handy for the end-user, it is of little interest to extension developers. In thefollowing, we’ll describe two ways to manually build extensions: Either by importing it into the main PHP source tree(this allows static linkage) or by doing an external build (only shared).Adding extensions to the PHP source tree¶
There is no fundamental difference between a third-party extension and an extension bundled with PHP. As such you canbuild an external extension simply by copying it into the PHP source tree and then using the usual build procedure.We’ll demonstrate this using APCu as an example.
First of all, you’ll have to place the source code of the extension into the
ext/EXTNAME
directory of your PHPsource tree. If the extension is available via git, this is as simple as cloning the repository from within ext/
:Alternatively you can also download a source tarball and extract it:
Keygen Php Maker Extensions Chrome
The extension will contain a
config.m4
file, which specifies extension-specific build instructions for use byautoconf. To incorporate them into the ./configure
script, you’ll have to run ./buildconf
again. To ensure thatthe configure file is really regenerated, it is recommended to delete it beforehand:You can now use the
./config.nice
script to add APCu to your existing configuration or start over with a completelynew configure line:Finally run
make-jN
to perform the actual build. As we didn’t use --enable-apcu=shared
the extension isstatically linked into the PHP binary, i.e. no additional actions are needed to make use of it. Obviously you can alsouse makeinstall
to install the resulting binaries.Building extensions using phpize
¶
It is also possible to build extensions separately from PHP by making use of the
phpize
script that was alreadymentioned in the Building PHP section.phpize
plays a similar role as the ./buildconf
script used for PHP builds: First it will import the PHP buildsystem into your extension by copying files from $PREFIX/lib/php/build
. Among these files are acinclude.m4
(PHP’s M4 macros), phpize.m4
(which will be renamed to configure.in
in your extension and contains the mainbuild instructions) and run-tests.php
.Then
phpize
will invoke autoconf to generate a ./configure
file, which can be used to customize the extensionbuild. Note that it is not necessary to pass --enable-apcu
to it, as this is implicitly assumed. Instead you shoulduse --with-php-config
to specify the path to your php-config
script:You should always specify the
--with-php-config
option when building extensions (unless you have only a single,global installation of PHP), otherwise ./configure
will not be able to correctly determine what PHP version andflags to build against. Specifying the php-config
script also ensures that makeinstall
will move the generated.so
file (which can be found in the modules/
directory) to the right extension directory.As the
run-tests.php
file was also copied during the phpize
stage, you can run the extension tests usingmaketest
(or an explicit call to run-tests).The
makeclean
target for removing compiled objects is also available and allows you to force a full rebuild ofthe extension, should the incremental build fail after a change. Additionally phpize provides a cleaning option viaphpize--clean
. This will remove all the files imported by phpize
, as well as the files generated by the/configure
script.Displaying information about extensions¶
The PHP CLI binary provides several options to display information about extensions. You already know
-m
, which willlist all loaded extensions. You can use it to verify that an extension was loaded correctly:There are several further switches beginning with
--r
that expose Reflection functionality. For example you can use--ri
to display the configuration of an extension:The
--re
switch lists all ini settings, constants, functions and classes added by an extension:The
--re
switch only works for normal extensions, Zend extensions use --rz
instead. You can try this onopcache:As you can see, this doesn’t display any useful information. The reason is that opcache registers both a normalextension and a Zend extension, where the former contains all ini settings, constants and functions. So in thisparticular case you still need to use
--re
. Other Zend extensions make their information available via --rz
though.Extensions API compatibility¶
Extensions are very sensitive to 5 major factors. If they don’t fit, the extension won’t load into PHP and will beuseless:
- PHP Api Version
- Zend Module Api No
- Zend Extension Api No
- Debug mode
- Thread safety
The phpize tool recall you some of those information.So if you have built a PHP with debug mode, and try to make it load and use an extension which has been built withoutdebug mode, it simply won’t work. Same for the other checks.
PHP Api Version is the number of the version of the internal API. Zend Module Api No and Zend Extension Api Noare respectively about PHP extensions and Zend extensions API.
Those numbers are later passed as C macros to the extension being built, so that it can itself check against thoseparameters and take different code paths based on C preprocessor
#ifdef
s. As those numbers are passed to theextension code as macros, they are written in the extension structure, so that anytime you try to load this extension ina PHP binary, they will be checked against the PHP binary’s own numbers.If they mismatch, then the extension will not load, and an error message will be displayed.If we look at the extension C structure, it looks like this:
What is interesting for us so far, is the
STANDARD_MODULE_HEADER
macro. If we expand it, we can see:Notice how
ZEND_MODULE_API_NO
, ZEND_DEBUG
, USING_ZTS
are used.Keygen Php Maker Extensions Download
If you look at the default directory for PHP extensions, it should look like
no-debug-non-zts-20090626
. As you’dhave guessed, this directory is made of distinct parts joined together : debug mode, followed by thread safetyinformation, followed by the Zend Module Api No.So by default, PHP tries to help you navigating with extensions.Note
Usually, when you become an internal developer or an extension developer, you will have to play withthe debug parameter, and if you have to deal with the Windows platform, threads will show up as well. You canend with compiling the same extension several times against several cases of those parameters.
Remember that every new major/minor version of PHP change parameters such as the PHP Api Version, that’s why you needto recompile extensions against a newer PHP version.
Note
Zend Module Api No is itself built with a date using the year.month.day format. This is the date of the day theAPI changed and was tagged.Zend Extension Api No is the Zend version followed by Zend Module Api No.
Note
Too many numbers? Yes. One API number, bound to one PHP version, would really be enough for anybody and would easethe understanding of PHP versioning. Unfortunately, we got 3 different API numbers in addition to the PHP versionitself. Which one should you look for? The answer is any : they all-three-of-them evolve when PHP version evolve.For historical reasons, we got 3 different numbers.
But, you are a C developer anren’t you? Why not build a “compatibility” header on your side, based on such number?We authors, use something like this in extensions of ours:
See?
Keygen Php Maker Extensions Tutorial
Or, simpler (so better) is to use
PHP_VERSION_ID
which you are probably much more familiar about: