Home Backend Development PHP7 Detailed explanation of Php7.3 installation

Detailed explanation of Php7.3 installation

Dec 29, 2020 am 09:51 AM

PHP7The column introduces how to effectively install Php7.3

Detailed explanation of Php7.3 installation

# #Recommended (free): PHP7

Install it first (you don’t need to install it after it is installed):

mysql: https://blog.csdn. net/qq_40200087/article/details/89479137

nginx: https://blog.csdn.net/qq_40200087/article/details/89504980

Download: https://www.php. net/downloads.php#v7.3.4

Development tools:

 yum groupinstall "Development Tools" -y
Copy after login

Installation dependencies:

yum install libxml2-devel -y

yum install bzip2 bzip2-devel -y 

yum install curl-devel -y

yum install libjpeg-devel -y

yum install libpng libpng-devel -y

yum install freetype-devel -y

yum install libxslt-devel -y 

yum install libzip-devel  -y


或者合到一起安装
yum install libxml2-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel libxslt-devel libzip-devel -y
Copy after login

Unzip:

tar -zxvf php-xxx.tar.gz -C /usr/local/
Copy after login

Enter /usr/local And modify the name

cd /usr/local

mv php-7.3.xxx  php7.3
Copy after login

Compile

cd /usr/local/php7.3 

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-fpm-user=mysql --with-fpm-group=mysql --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli=mysqlnd --with-openssl --with-pcre-regex --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm
Copy after login
编译完成后是以下样子

+--------------------------------------------------------------------+
| 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.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/phpdbg/phpdbg.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: WARNING: unrecognized options: --with-mysql
Copy after login

Installation:

make && make install
Copy after login

Copy the following three configuration files

cp php.ini-production /usr/local/php/etc/php.ini

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

cp /usr/local/php/etc/php-fpm.d/www.conf.default  /usr/local/php/etc/php-fpm.d/www.conf
Copy after login

Set php.ini

#注意:php的注释为 ; 如果设置前面有 ; ,请记得删除 ;
vim /usr/local/php/etc/php.ini

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
date.timezone = Asia/Shanghai
Copy after login

Test whether php is installed successfully

/usr/local/php/sbin/php-fpm -t
Copy after login

Copy the startup file

cp /usr/local/php7.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
Copy after login

Give execution permission

chmod 755 /etc/init.d/php-fpm
Copy after login

Startup

service php-fpm start
Copy after login

Query whether the startup is successful

ps -ef |grep php-fpm

root      27332      1  0 08:51 ?        00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
mysql     27333  27332  0 08:51 ?        00:00:00 php-fpm: pool www
mysql     27334  27332  0 08:51 ?        00:00:00 php-fpm: pool www
root      27336   7898  0 08:51 pts/1    00:00:00 grep --color=auto php-fpm
Copy after login

Configure nginx to parse .php files

注意:fastcgi_pass 127.0.0.1:9000; 端口与/usr/local/php/etc/php-fpm.d/www.conf 里面的listen = 127.0.0.1:9000 配置要一样,不然无法解析


vim /usr/local/nginx/conf/nginx.conf 修改server{} 这个里面的数据为:

        listen       80;
        server_name  localhost;

        access_log  /usr/local/nginx/logs/host.access.log;
        root /usr/local/nginx/html;
        index  index.html index.htm index.php;
        location / {
            try_files $uri $uri/ /index.php?$args;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            expires -1s;
            try_files $uri =404;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi.conf;
        }
Copy after login

Test whether the parsing is successful:

在/usr/local/nginx/html中创建test.php,里面内容如下

<?php
 phpinfo();
?>

执行 /usr/local/nginx/sbin/nginx

浏览去输入 http://本机ip/test.php

如果打开网页了则解析成功,如果是下载,则解析失败
Copy after login

Encountered an error:

执行测试的时候遇到

[root@jenkins-master etc]# /usr/local/php/sbin/php-fpm -t
PHP:  syntax error, unexpected &#39;=&#39; in Unknown on line 1
[25-Apr-2019 08:36:28] ERROR: Unable to include /usr/local/php/etc/php-fpm.d/www.conf from /usr/local/php/etc/php-fpm.conf at line 23
[25-Apr-2019 08:36:28] ERROR: failed to load configuration file &#39;/usr/local/php/etc/php-fpm.conf&#39;
[25-Apr-2019 08:36:28] ERROR: FPM initialization failed



最后发现是我执行./configue 的时候后面配置文件有一个少了个空格,我已修改上面的配置

原因呢是因为 www.conf 里面的user配置错误
Copy after login

The above is the detailed content of Detailed explanation of Php7.3 installation. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to Use Sessions Effectively in PHP 7? How to Use Sessions Effectively in PHP 7? Mar 10, 2025 pm 06:20 PM

This article details effective PHP 7 session management, covering core functionalities like session_start(), $_SESSION, session_destroy(), and secure cookie handling. It emphasizes security best practices including HTTPS, session ID regeneration, s

How to Monitor PHP 7 Performance with Tools like New Relic? How to Monitor PHP 7 Performance with Tools like New Relic? Mar 10, 2025 pm 06:28 PM

This article explains how to monitor PHP 7 application performance using New Relic. It details New Relic's setup, key performance indicators (KPIs) like Apdex score and response time, bottleneck identification via transaction traces and error track

How to Upgrade from PHP 5.6 to PHP 7? How to Upgrade from PHP 5.6 to PHP 7? Mar 10, 2025 pm 06:29 PM

This article details upgrading PHP 5.6 to PHP 7, emphasizing crucial steps like backing up, checking server compatibility, and choosing an upgrade method (package manager, compiling, control panel, or web server configuration). It addresses potentia

How to Autoload Classes in PHP 7? How to Autoload Classes in PHP 7? Mar 10, 2025 pm 06:20 PM

This article explains PHP 7's autoloading, using spl_autoload_register() to load classes on demand. It details best practices like namespace-based autoloading and caching for performance optimization, addresses common issues (e.g., class not found

How to Deploy a PHP 7 Application to a Web Server? How to Deploy a PHP 7 Application to a Web Server? Mar 10, 2025 pm 06:28 PM

This article details deploying PHP 7 applications, covering methods (FTP, SSH, deployment tools), server configuration (Apache/Nginx, PHP-FPM), database setup, and crucial security considerations. It highlights common challenges like server compatib

How to Use Git for Version Control in PHP 7 Projects? How to Use Git for Version Control in PHP 7 Projects? Mar 10, 2025 pm 06:27 PM

This article guides PHP 7 developers on using Git for version control. It covers initialization, staging, committing, ignoring files, remote repositories, branching, merging, conflict resolution, and essential Git commands. Best practices for effic

How to Use Xdebug for Debugging PHP 7 Code? How to Use Xdebug for Debugging PHP 7 Code? Mar 10, 2025 pm 06:26 PM

This article explains how to use Xdebug for debugging PHP 7 code. It covers Xdebug configuration (installation, php.ini settings, IDE setup), breakpoint usage (conditional, function, remote), and troubleshooting connection issues. Effective debuggi

How to Include and Require Files in PHP 7? How to Include and Require Files in PHP 7? Mar 10, 2025 pm 02:52 PM

This article explains PHP 7's include, include_once, require, and require_once file inclusion methods. It details their differences in error handling (warnings vs. fatal errors) and multiple inclusion prevention. Best practices for file organizatio

See all articles