Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install PHP 5.6,7.1,7.2 On linux (Debian, Ubuntu, Mint ...) and Switch From PHP 5.6 => PHP 7.1
Install PHP 5.6,7.1,7.2 On linux (Debian, Ubuntu, Mint ...) and Switch From PHP 5.6 => PHP 7.1
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6
heck Installed PHP Version
php -v
Install PHP 5.6 Modules
Show available PHP Modules list
sudo apt-cache search php5.6-*
Install modules which is required for you.
Example PHP 5.6:
sudo apt-get install libapache2-mod-php5.6 php5.6-cgi php5.6-cli php5.6-curl php5.6-imap php5.6-gd php5.6-mysql php5.6-pgsql php5.6-sqlite3 php5.6-mbstring php5.6-json php5.6-bz2 php5.6-mcrypt php5.6-xmlrpc php5.6-gmp php5.6-xsl php5.6-soap php5.6-xml php5.6-zip php5.6-dba
Example PHP 7:
sudo apt-get install libapache2-mod-php7.0 php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-gd
PHP 5.6 Modules list (Example)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-geoip - GeoIP module for PHP
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
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-uuid - PHP UUID extension
php-yac - YAC (Yet Another Cache) for PHP
php-zmq - ZeroMQ messaging bindings for PHP
php-radius - radius client library for PHP
php-http - PECL HTTP module for PHP Extended HTTP Support
php-uploadprogress - file upload progress tracking extension for PHP
libapache2-mod-php5.6 - server-side, HTML-embedded scripting language (Apache 2 module)
php5.6-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5.6-cli - command-line interpreter for the PHP scripting language
php5.6-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php5.6-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
libphp5.6-embed - HTML-embedded scripting language (Embedded SAPI library)
php5.6-dev - Files for PHP5.6 module development
php5.6-common - documentation, examples and common module for PHP
php5.6 - server-side, HTML-embedded scripting language (metapackage)
php5.6-curl - CURL module for PHP
php5.6-gd - GD module for PHP
php5.6-imap - IMAP module for PHP
php5.6-intl - Internationalisation module for PHP
php5.6-ldap - LDAP module for PHP
php5.6-mysql - MySQL module for PHP
php5.6-pgsql - PostgreSQL module for PHP
php5.6-pspell - pspell module for PHP
php5.6-recode - recode module for PHP
php5.6-snmp - SNMP module for PHP
php5.6-sqlite3 - SQLite3 module for PHP
php5.6-sybase - Sybase module for PHP
php5.6-tidy - tidy module for PHP
php5.6-opcache - Zend OpCache module for PHP
php-xdebug - Xdebug Module for PHP
php5.6-json - JSON module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php5.6-bz2 - bzip2 module for PHP
php5.6-mcrypt - libmcrypt module for PHP
php5.6-odbc - ODBC module for PHP
php5.6-readline - readline module for PHP
php5.6-interbase - Interbase module for PHP
php5.6-xmlrpc - XMLRPC-EPI module for PHP
php5.6-enchant - Enchant module for PHP
php5.6-gmp - GMP module for PHP
php5.6-xsl - XSL module for PHP (dummy)
php-memcache - memcache extension module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php5.6-bcmath - Bcmath module for PHP
php5.6-mbstring - MBSTRING module for PHP
php5.6-soap - SOAP module for PHP
php5.6-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php5.6-zip - Zip module for PHP
php-tideways - Tideways PHP Profiler Extension
php-mailparse - Email message manipulation for PHP
php-propro - propro module for PHP
php-raphf - raphf module for PHP
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-gearman - PHP wrapper to libgearman
php-xcache - fast, stable PHP opcode cacher
php-mongo - MongoDB database driver
php5.6-dba - DBA module for PHP
php-xhprof - Hierarchical Profiler for PHP 5.x
Install PHP 7.1
sudo update-alternatives --set php /usr/bin/php7.0
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1
php -v
PHP 7.1 Modules list (Example)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-geoip - GeoIP module for PHP
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
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-uuid - PHP UUID extension
php-yac - YAC (Yet Another Cache) for PHP
php-zmq - ZeroMQ messaging bindings for PHP
php-radius - radius client library for PHP
php-http - PECL HTTP module for PHP Extended HTTP Support
php-yaml - YAML-1.1 parser and emitter for PHP
php-all-dev - package depending on all supported PHP development packages
php-xdebug - Xdebug Module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-apcu-bc - APCu Backwards Compatibility Module
php-memcache - memcache extension module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-tideways - Tideways PHP Profiler Extension
php-mailparse - Email message manipulation for PHP
php-gnupg - PHP wrapper around the gpgme library
php-propro - propro module for PHP
php-raphf - raphf module for PHP
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-gearman - PHP wrapper to libgearman
libapache2-mod-php7.1 - server-side, HTML-embedded scripting language (Apache 2 module)
libphp7.1-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.1-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.1-cli - command-line interpreter for the PHP scripting language
php7.1-dev - Files for PHP7.1 module development
php7.1-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.1-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.1-bcmath - Bcmath module for PHP
php7.1-bz2 - bzip2 module for PHP
php7.1-common - documentation, examples and common module for PHP
php7.1-curl - CURL module for PHP
php7.1-dba - DBA module for PHP
php7.1-enchant - Enchant module for PHP
php7.1-gd - GD module for PHP
php7.1-gmp - GMP module for PHP
php7.1-imap - IMAP module for PHP
php7.1-interbase - Interbase module for PHP
php7.1-intl - Internationalisation module for PHP
php7.1-json - JSON module for PHP
php7.1-ldap - LDAP module for PHP
php7.1-mbstring - MBSTRING module for PHP
php7.1-mcrypt - libmcrypt module for PHP
php7.1-mysql - MySQL module for PHP
php7.1-odbc - ODBC module for PHP
php7.1-pgsql - PostgreSQL module for PHP
php7.1-pspell - pspell module for PHP
php7.1-readline - readline module for PHP
php7.1-recode - recode module for PHP
php7.1-snmp - SNMP module for PHP
php7.1-soap - SOAP module for PHP
php7.1-sqlite3 - SQLite3 module for PHP
php7.1-sybase - Sybase module for PHP
php7.1-tidy - tidy module for PHP
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1-xmlrpc - XMLRPC-EPI module for PHP
php7.1-zip - Zip module for PHP
php7.1-opcache - Zend OpCache module for PHP
php7.1 - server-side, HTML-embedded scripting language (metapackage)
php7.1-xsl - XSL module for PHP (dummy)
php-phalcon - full-stack PHP framework delivered as a C-extension
php-ds - PHP extension providing efficient data structures for PHP 7
php-sass - PHP bindings to libsass - fast, native Sass parsing in PHP
php-lua - PHP Embedded lua interpreter
php-sodium - PHP wrapper for the Sodium cryptographic library
sudo apt-get install php-mongodb php-http php-yaml php-xdebug php-memcached php-memcache php-mailparse php-gnupg php-stomp libapache2-mod-php7.1 libphp7.1-embed php7.1-cgi php7.1-cli php7.1-dev php7.1-fpm php7.1-phpdbg php7.1-bcmath php7.1-bz2 php7.1-common php7.1-curl php7.1-dba php7.1-gmp php7.1-imap php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-odbc php7.1-pgsql php7.1-snmp php7.1-soap php7.1-sqlite3 php7.1-sybase php7.1-xml php7.1-xmlrpc php7.1-zip php7.1-opcache php7.1 php7.1-xsl php-ds php-sass php-lua
Switch From PHP 5.6 => PHP 7.1
Default PHP 5.6 is set on your system and you need to switch to PHP 7.1.
Apache:-
$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart
Command Line:-
$ update-alternatives --set php /usr/bin/php7.1
From PHP 7.1 => PHP 5.6
Default PHP 7.1 is set on your system and you need to switch to PHP 5.6.
Apache:-
$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart
Command Line:-
$ sudo update-alternatives --set php /usr/bin/php5.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.