Home > Backend Development > PHP Problem > How to compile php7 installation directory

How to compile php7 installation directory

尊渡假赌尊渡假赌尊渡假赌
Release: 2023-06-05 09:26:02
Original
1692 people have browsed it

The method to compile the php7 installation directory is: 1. Download the source code of PHP7 and extract it to the local directory; 2. Install the required dependency packages to ensure that PHP7 can run normally; 3. Enter the PHP7 source code Directory, configure the compilation parameters of PHP7; 4. Execute the command to compile and install PHP7.

How to compile php7 installation directory

The operating system of this tutorial: Linux5.18.14 system, php7 version, Dell G3 computer.

The method to compile the php7 installation directory is:

1. Download the source code of PHP7

Download the latest PHP7 source code compression package from the PHP official website and extract it locally in the directory. For example:

$ wget https://www.php.net/distributions/php-7.4.11.tar.gz
$ tar -zxvf php-7.4.11.tar.gz
Copy after login

2. Install the required dependency packages

Before compiling PHP7, you need to install some dependency packages to ensure that PHP7 can run normally. Depending on different Linux distributions, the required dependency packages may be different. For details, please refer to the PHP official documentation. The following are the commands to install the necessary dependency packages on Ubuntu Linux:

$ sudo apt-get update
$ sudo apt-get install build-essential libxml2-dev libssl-dev libsqlite3-dev libpng-dev libjpeg-dev libfreetype6-dev libbz2-dev libcurl4-openssl-dev libjpeg8-dev libpng-dev libmcrypt-dev libxslt1-dev
Copy after login

3. Configure the compilation parameters of PHP7

Enter the PHP7 source code directory and execute the following command to configure the compilation parameters:

$ cd php-7.4.11
$ ./configure --prefix=/var/www/php7 --with-config-file-path=/var/www/php7/etc --with-zlib --enable-exif --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
Copy after login

Here we specify the root directory of PHP7 after installation as /var/www/php7, and also specify the configuration file path of PHP7 and some extensions that need to be enabled.

4. Compile and install PHP7

Execute the following command to compile and install:

$ make
$ sudo make install
Copy after login

After execution, PHP7 will be installed in the specified directory.

The above is the detailed content of How to compile php7 installation directory. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template