在 Ubuntu/Debian 下安装 PHP7.3 教程

Ubuntu

安装软件源拓展工具:

apt -y install software-properties-common apt-transport-https lsb-release ca-certificates

添加 Ondřej Surý 的 PHP PPA 源,需要按一次回车:

add-apt-repository ppa:ondrej/php  

更新软件源缓存:

apt update

Debian

安装软件源拓展工具:

apt -y install software-properties-common apt-transport-https lsb-release ca-certificates

添加 GPG

wget -O /etc/apt/trusted.gpg.d/php.gpg https://mirror.xtom.com.hk/sury/php/apt.gpg

添加 sury 软件源

sh -c 'echo "deb https://mirror.xtom.com.hk/sury/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'   

更新软件源缓存:

apt-get update

安装软件

安装 PHP7.3:

apt install php7.3-fpm php7.3-mysql php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-xmlrpc php7.3-zip php7.3-opcache -y

设置 PHP

安装完成后,编辑 /etc/php/7.3/fpm/php.ini 替换换 ;cgi.fix_pathinfo=1 为 cgi.fix_pathinfo=0 快捷命令:

sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.3/fpm/php.ini 

管理 PHP

安装好了先重启一下!

systemctl restart php7.3-fpm

更多操作:


 
 

systemctl restart php7.3-fpm #重启

 

systemctl start php7.3-fpm #启动

 

systemctl stop php7.3-fpm #关闭

 

systemctl status php7.3-fpm #检查状态

查看 PHP

验证一下是否安装成功:


 
 

root@mf88.biz-service:~# php -v

 

PHP 7.3.0-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Dec 6 2018 20:24:55) ( NTS )

 

Copyright (c) 1997-2018 The PHP Group

 

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

 

with Zend OPcache v7.3.0-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

更新 PHP

运行下面的命令系统就会更新所有可以更新的软件包括 PHP


 
 

apt update

 

apt upgrade -y

安装更多组件

上面的一条命令安装 PHP 只是安装了部分 PHP 拓展,更多的软件可见:


 
 

root@mf88.biz-service:~# apt-cache search php7.3

 

php-amqp - AMQP extension for PHP

 

php-apcu - APC User Cache for PHP

 

php-apcu-bc - APCu Backwards Compatibility Module

 

php-ds - PHP extension providing efficient data structures for PHP 7

 

php-gearman - PHP wrapper to libgearman

 

php-geoip - GeoIP module for PHP

 

php-gmagick - Provides a wrapper to the GraphicsMagick library

 

php-gnupg - PHP wrapper around the gpgme library

 

php-http - PECL HTTP module for PHP Extended HTTP Support

 

php-igbinary - igbinary PHP serializer

 

php-imagick - Provides a wrapper to the ImageMagick library

 

php-mailparse - Email message manipulation for PHP

 

php-memcache - memcache extension module for PHP

 

php-memcached - memcached extension module for PHP, uses libmemcached

 

php-mongodb - MongoDB driver for PHP

 

php-msgpack - PHP extension for interfacing with MessagePack

 

php-oauth - OAuth 1.0 consumer and provider extension

 

php-propro - propro module for PHP

 

php-radius - radius client library for PHP

 

php-raphf - raphf module for PHP

 

php-redis - PHP extension for interfacing with Redis

 

php-rrd - PHP bindings to rrd tool system

 

php-smbclient - PHP wrapper for libsmbclient

 

php-solr - PHP extension for communicating with Apache Solr server

 

php-ssh2 - Bindings for the libssh2 library

 

php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP

 

php-tideways - Tideways PHP Profiler Extension

 

php-uploadprogress - file upload progress tracking extension for PHP

 

php-uuid - PHP UUID extension

 

php-yac - YAC (Yet Another Cache) for PHP

 

php-yaml - YAML-1.1 parser and emitter for PHP

 

php-zmq - ZeroMQ messaging bindings for PHP

 

php-xdebug - Xdebug Module for PHP

 

php-lua - PHP Embedded lua interpreter

 

libapache2-mod-php7.3 - server-side, HTML-embedded scripting language (Apache 2 module)

 

libphp7.3-embed - HTML-embedded scripting language (Embedded SAPI library)

 

php7.3-bcmath - Bcmath module for PHP

 

php7.3-bz2 - bzip2 module for PHP

 

php7.3-cgi - server-side, HTML-embedded scripting language (CGI binary)

 

php7.3-cli - command-line interpreter for the PHP scripting language

 

php7.3-common - documentation, examples and common module for PHP

 

php7.3-curl - CURL module for PHP

 

php7.3-dba - DBA module for PHP

 

php7.3-dev - Files for PHP7.3 module development

 

php7.3-enchant - Enchant module for PHP

 

php7.3-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)

 

php7.3-gd - GD module for PHP

 

php7.3-gmp - GMP module for PHP

 

php7.3-imap - IMAP module for PHP

 

php7.3-interbase - Interbase module for PHP

 

php7.3-intl - Internationalisation module for PHP

 

php7.3-json - JSON module for PHP

 

php7.3-ldap - LDAP module for PHP

 

php7.3-mbstring - MBSTRING module for PHP

 

php7.3-mysql - MySQL module for PHP

 

php7.3-odbc - ODBC module for PHP

 

php7.3-opcache - Zend OpCache module for PHP

 

php7.3-pgsql - PostgreSQL module for PHP

 

php7.3-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)

 

php7.3-pspell - pspell module for PHP

 

php7.3-readline - readline module for PHP

 

php7.3-recode - recode module for PHP

 

php7.3-snmp - SNMP module for PHP

 

php7.3-soap - SOAP module for PHP

 

php7.3-sqlite3 - SQLite3 module for PHP

 

php7.3-sybase - Sybase module for PHP

 

php7.3-tidy - tidy module for PHP

 

php7.3-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP

 

php7.3-xmlrpc - XMLRPC-EPI module for PHP

 

php7.3-zip - Zip module for PHP

 

php7.3-xsl - XSL module for PHP (dummy)

 

php7.3 - server-side, HTML-embedded scripting language (metapackage)

发布了29 篇原创文章 · 获赞 7 · 访问量 3万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览