Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process steps of compiling and installing PHP 7.3 under ubuntu

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Download the PHP source code

First of all, you need to download the source code of PHP7.3.1 from the PHP official website and save it as php-7.3.1.tar.xz. Http://cn2.php.net/distributions/php-7.3.1.tar.xz

Open the terminal in the directory where the above file is saved, use the command to extract it, and use cd to enter the decompressed directory

Tar-xvJf. / php-7.3.1.tar.xz

Cd php-7.3.1

1. Installation dependency

Second, you need to install some of the dependencies needed to compile PHP

Sudo apt update

Sudo apt install gcc

Sudo apt install make

Sudo apt install openssl

Sudo apt install curl

Sudo apt install libbz2-dev

Sudo apt install libxml2-dev

Sudo apt install libjpeg-dev

Sudo apt install libpng-dev

Sudo apt install libfreetype6-dev

Sudo apt install libzip-dev

two。 Pre-compiled PHP

Before compilation, PHP needs to be configured to generate the corresponding makefile file

/ configure-- prefix=/usr/local/php-- with-config-file-path=/usr/local/php/etc-- enable-fpm-- with-fpm-user=www-- with-fpm-group=www-- with-mysqli-- with-pdo-mysql-- with-iconv-dir-- with-freetype-dir-- with-jpeg-dir-- with-png-dir-- with-zlib-- with-libxml-dir=/usr-- enable-xml-- disable-rpath-- enable-bcmath-- enable -shmop-- enable-sysvsem-- enable-inline-optimization-- with-curl-- enable-mbregex-- enable-mbstring-- with-gd-- with-openssl-- with-mhash-- enable-pcntl-- enable-sockets-- with-xmlrpc-- enable-zip-- enable-soap-- without-pear-with-gettext-- disable-fileinfo-- enable-maintainer-zts

After the configuration is successful, the following words appear

+-- +

| | License: |

| | This software is subject to the PHP License, available in this |

| distribution in the file LICENSE. By continuing this installation |

| process, you are bound by the terms of this license agreement. | |

| | If you do not agree with the terms of this license, you must abort |

| the installation process at this point. | |

+-- +

Thank you for using PHP.

3. Compile and install PHP

Make

Make install

4. Verify PHP

You can use the following instructions to output the version of PHP to verify that it is installed correctly

/ usr/local/php/bin/php-v

If installed correctly, the following will appear

PHP 7.3.1 (cli) (built: Jan 18 2019 20:11:04) (ZTS)

Copyright (c) 1997-2018 The PHP Group

Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies

At this point, PHP7.3.1 is successfully compiled and installed from the source code.

5. Copy php.ini

The compiled and installed directory will not have a ready-made php.ini and needs to be copied manually.

In the extracted source code directory, there are php.ini-development for the development environment and php.ini-production for the production environment.

Cp php.ini-development / usr/local/php/etc/php.ini

Cp / usr/local/php5/etc/php-fpm.conf.default / usr/local/php5/etc/php-fpm.conf

Cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm

/ usr/local/php5/sbin/php-fpm

Start php error report

Cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf

# / usr/local/php/sbin/php-fpm

[29-Nov-2019 13:04:49] ERROR: [pool www] cannot get uid for user 'www'

[29-Nov-2019 13:04:49] ERROR: FPM initialization failed

Create a www user group

Create nginx users and user groups directly

Useradd nginx

Groupadd nginx

Usermod-G nginx nginx

/ usr/local/php5/sbin/php-fpm

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report