PHP建站

Debian免编译快速安装PHP(v5.6,v7.0,v7.1)

2018-10-13  本文已影响1人  8fb46c170015

部署这里PHP将完整不compile-任何组件,完整依靠软件源部署。供给PHP软件源的Ondřej Surý大神的英文Debian社区中PHP源的保护者,因而无需担忧软件的宁静和性能问题肯定比咱们伏笔VPS编译更好,软件源部署的PHP以原始Unix Socket的状态执行在/run/php/php7.1-fpm.sock,使用比TCP以fubitechalhost:9000的方法性能更好。

部署

适用系统:Debian 9 /Debian 8

如图1所示,软件部署源拓展

Sury官方原始源:HTTPS://packages.sury.org/php/ 

镜像源:HTTPS://mirror.xtom.com.hk/sury/php/

增加GPG

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

部署apt-transport-https

apt-get install apt-transport-https

增加sury软件源

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

更新软件源缓存

apt-get update

2,部署PHP

部署PHP7.1:

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

部署PHP7.0:

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

部署PHP5.6:

apt install php5.6-fpm php5.6-mysql php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-xml php5.6-xmlrpc php5.6-zip php5.6-opcache -y

3,设置PHP

这里以PHP7.1为例,其他版本仅需将版本号改成伏笔VPS所用的便可。

部署完成后,修改/etc/php/7.1/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.1/fpm/php.ini

4,管理PHP

部署好了先重启一下!

更多操作:

systemctl restart php7.1-fpm #rebootsystemctl start php7.1-fpm #启动systemctl stop php7.1-fpm #关闭systemctl status php7.1-fpm #检查状态

当前查看PHP版本:

php -v

5,更新PHP

执行上面的命令系统就会更新一切可以更新的软件包括PHP:

apt updateapt upgrade -y

6、部署更多组件

上面的一条command部署PHP只是部署了有些PHP拓展,更多的软件可见:

root@Rats:~# apt-cache search php7.1libapache2-mod-php7.1 - server-side, HTML-embedded scripting language (Apache 2 module)php-all-dev - package depending on all supported PHP development packagesphp7.1 - server-side, HTML-embedded scripting language (metapackage)php7.1-cgi - server-side, HTML-embedded scripting language (CGI binary)php7.1-cli - command-line interpreter for the PHP scripting languagephp7.1-common - documentation, examples and common module for PHPphp7.1-curl - CURL module for PHPphp7.1-dev - Files for php7.1 module developmentphp7.1-gd - GD module for PHPphp7.1-gmp - GMP module for PHPphp7.1-json - JSON module for PHPphp7.1-ldap - LDAP module for PHPphp7.1-mysql - MySQL module for PHPphp7.1-odbc - ODBC module for PHPphp7.1-opcache - Zend OpCache module for PHPphp7.1-pgsql - PostgreSQL module for PHPphp7.1-pspell - pspell module for PHPphp7.1-readline - readline module for PHPphp7.1-recode - recode module for PHPphp7.1-snmp - SNMP module for PHPphp7.1-sqlite3 - SQLite3 module for PHPphp7.1-tidy - tidy module for PHPphp7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHPphp7.1-xmlrpc - XMLRPC-EPI module for PHPlibphp7.1-embed - HTML-embedded scripting language (Embedded SAPI library)php7.1-bcmath - Bcmath module for PHPphp7.1-bz2 - bzip2 module for PHPphp7.1-enchant - Enchant module for PHPphp7.1-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)php7.1-imap - IMAP module for PHPphp7.1-interbase - Interbase module for PHPphp7.1-intl - Internationalisation module for PHPphp7.1-mbstring - MBSTRING module for PHPphp7.1-mcrypt - libmcrypt module for PHPphp7.1-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)php7.1-soap - SOAP module for PHPphp7.1-sybase - Sybase module for PHPphp7.1-xsl - XSL module for PHP (dummy)php7.1-zip - Zip module for PHPphp7.1-dba - DBA module for PHP

希望以上的文章对各位有用,如果觉得不错给我点个喜欢吧!更多和Debian免编译快速安装PHP(v5.6,v7.0,v7.1)教程相关的问题或者对香港虚拟主机哪家好用有疑惑也欢迎大家咨询。

上一篇 下一篇

猜你喜欢

热点阅读