Before downloading the source code, I wrote an article containing a tutorial on installing php with the source code. Therefore, you only need to download the GMP source code. It is better to go to the official website (gmplib) to download the source code. The latest version of GMP is GMP6.0.0. then there are three compressed files on the download page. I chose gmp-6.0.0a.tar. xz. Because
Before downloading the source code, I wrote an article containing a tutorial on installing php with the source code. Therefore, you only need to download the GMP source code. It is better to go to the official website (gmplib) to download the source code. Now the latest version of GMP is GMP 6.0.0. There are three compressed files on the download page. I chose gmp-6.0.0a.tar. xz. Because
Source code download
I have written an article with a tutorial on installing php with source code.
Therefore, you only need to download the GMP source code.
It is better to go to the official website (gmplib) to download the source code.
The latest version of GMP is GMP 6.0.0.
On the download page, there are three compressed files.
I chose gmp-6.0.0a.tar. xz.
Because my compression tool can only decompress this file.
Decompress the tar. xz File
I have never seen the compressed files in tar. xz, but there are still corresponding compression commands.
I found it on CSDN.
#-K keep the compressed file xz-k ***. tar. xztar-xzvf ***. tar
Install GMP
The installation command is also displayed on the installation tutorial page on the official website.
Simply put
./configuremakemake install
Php additional gmp source code compilation
On the gmp installation tutorial page on the php official website, you can see that--with-gmp
Parameter.
./configure --enable-shmopmakemake install
After installation, restart the server.
Dynamic addition of php module extensions
Specifying the required module extension during php compilation is certainly successful, but most of the time we don't want to compile the php source code again.
In addition, we do not remember the parameters during compilation.
Even if you remember those parameters, it takes a long time to compile them once. We don't want to wait that time.
Therefore, the need to dynamically add modules to expand must be addressed.
Then I found an extension on the php official website, such as pecl.
In the last row of the Directory, You can see Compiling PECL extensions statically into PHP.
The general meaning is to compile the extension into php.
Then you can see Compiling shared PECL extensions with the pecl command and Compiling shared PECL extensions with phpize in the fourth and fifth rows.
Php has two ways to dynamically add module extensions. One is to use the pecl command, and the other is to use phpize.
Next let's take a look at it separately.
Pecl command to dynamically install php module Extension
Here is a simple description on the pecl page.
You only need the following command to download the corresponding module source code and install it in php.
However, since I have chosen the source code for installation, it is definitely not to show that I am a good player, but that the environment itself has no network.
So this method does not work.
pecl install extname
Phpize dynamic installation of php module Extension
Fortunately, pecl does not work. phpize can install the required extensions offline.
We downloaded the source code. Run phpize before compilation and installation, and then use the extension after normal installation.
cd extnamephpize./configuremakemake install
After installation, you must configure the php. ini file and add it to the installation module.
This article from: http://tiankonguse.github.io, original address: http://github.tiankonguse.com//blog/2014/11/20/php-source-install-gmp/, thanks to the original author to share.