How to install all php modules

How To Install PHP Modules on Ubuntu 20.04 | 18.04

Before you get started you need to have PHP installed on your Ubuntu system. If you haven’t you can start with this tutorial on how to install LAMP on Ubuntu 20.04. Once you are done with that tutorial, specifically the PHP install section then you can proceed with this tutorial

You may now proceed to set up the modules based on your application requirements. You can start by searching for PHP 7 modules in the apt package repository.

$ sudo apt-cache search php7*

The following is a partial output of what to expect.

Output php7.4-bcmath - Bcmath module for PHP php7.4-bz2 - bzip2 module for PHP php7.4-cgi - server-side, HTML-embedded scripting language (CGI binary) php7.4-cli - command-line interpreter for the PHP scripting language php7.4-common - documentation, examples and common module for PHP php7.4-curl - CURL module for PHP php7.4-dba - DBA module for PHP php7.4-dev - Files for PHP7.4 module development . php8.0-bz2 - bzip2 module for PHP php8.0-cgi - server-side, HTML-embedded scripting language (CGI binary) php8.0-cli - command-line interpreter for the PHP scripting language php8.0-common - documentation, examples and common module for PHP php8.0-curl - CURL module for PHP php8.0-dba - DBA module for PHP php8.0-dev - Files for PHP8.0 module development php8.0-ds - PHP extension providing efficient data structures for PHP 7 php8.0-enchant - Enchant module for PHP php8.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary) php8.0-gd - GD module for PHP

You can now install the required PHP modules on your system as listed in the above command using the command in the format below.

$ sudo apt-get install php7.4-mysql php7.4-curl php7.4-json php7.4-bz2

There you have it! You are now ready to use PHP in your applications.

Next, you can follow this tutorial to learn how to enable and disable PHP modules on a version or SAPI basis on Ubuntu.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Источник

Установка PHP и модулей на Ubuntu/Debian

В Debian и Ubuntu есть несколько вариантов работы php: как модуль apache и как php-fpm. Первый вариант удобен тем, кому придется использовать не только сам PHP, но и возможности Apache, такие как .htaccess. Второй же вариат удобен например для Yii или Laravel.

Установка PHP 5 как модуля Apache:

apt-get update apt-get install libapache2-mod-php5 php5-cli php5-memcache php5-memcached php5-mysql php5-pgsql php5-curl php5-gd php5-imagick php5-intl php5-mcrypt

Установка PHP 7 как модуля Apache:

apt-get update apt-get install libapache2-mod-php7.0 php7.0-curl php7.0-cli php-memcache php-memcached php7.0-mysql php7.0-pgsql php7.0-gd php7.0-imagick php7.0-intl php7.0-mcrypt

Установка PHP 5 как PHP-FPM:

apt-get update apt-get install php5-fpm php5-cli php5-memcache php5-memcached php5-mysql php5-pgsql php5-curl php5-gd php5-imagick php5-intl php5-mcrypt

Установка PHP 7 как PHP-FPM

apt-get update apt-get install php7.0-fpm php7.0-curl php7.0-cli php-memcache php-memcached php7.0-mysql php7.0-pgsql php7.0-gd php7.0-imagick php7.0-intl php7.0-mcrypt

В Debian и Ubuntu зачастую установка модулей PHP не требует каких-то сложных манипуляций. Для того, чтобы посмотреть, что Вы можете поставить прямо сейчас, нужно сделать:

lynx@lnxdsk:~$ apt-cache search php7.0 php-amqp - AMQP extension for PHP php-apcu - APC User Cache for PHP php-all-dev - package depending on all supported PHP development packages 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-igbinary - igbinary PHP serializer php-imagick - Provides a wrapper to the ImageMagick library php-libsodium - PHP wrapper for the Sodium cryptographic 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-http - PECL HTTP module for PHP Extended HTTP Support php-pinba - Pinba module for PHP 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-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 php7.0 - server-side, HTML-embedded scripting language (metapackage) php7.0-bcmath - Bcmath module for PHP php7.0-bz2 - bzip2 module for PHP php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary) php7.0-cli - command-line interpreter for the PHP scripting language php7.0-common - documentation, examples and common module for PHP php7.0-curl - CURL module for PHP php7.0-dba - DBA module for PHP php7.0-dev - Files for PHP7.0 module development php7.0-enchant - Enchant module for PHP php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary) php7.0-gd - GD module for PHP php7.0-gmp - GMP module for PHP php7.0-imap - IMAP module for PHP php7.0-interbase - Interbase module for PHP php7.0-intl - Internationalisation module for PHP php7.0-json - JSON module for PHP php7.0-ldap - LDAP module for PHP php7.0-mbstring - MBSTRING module for PHP php7.0-mcrypt - libmcrypt module for PHP php7.0-mysql - MySQL module for PHP php7.0-odbc - ODBC module for PHP php7.0-opcache - Zend OpCache module for PHP php7.0-pgsql - PostgreSQL module for PHP php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary) php7.0-pspell - pspell module for PHP php7.0-readline - readline module for PHP php7.0-recode - recode module for PHP php7.0-snmp - SNMP module for PHP php7.0-soap - SOAP module for PHP php7.0-sqlite3 - SQLite3 module for PHP php7.0-sybase - Sybase module for PHP php7.0-tidy - tidy module for PHP php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP php7.0-xmlrpc - XMLRPC-EPI module for PHP php7.0-xsl - XSL module for PHP (dummy) php7.0-zip - Zip module for PHP

Давайте для примера установим GD для работы с изображениями:

lynx@lnxdsk:~$ sudo apt-get install php7.0-gd Чтение списков пакетов… Готово Построение дерева зависимостей Чтение информации о состоянии… Готово Заметьте, вместо «php7.0-gd» выбирается «php-gd» НОВЫЕ пакеты, которые будут установлены: php-gd обновлено 0, установлено 1 новых пакетов, для удаления отмечено 0 пакетов, и 148 пакетов не обновлено. Необходимо скачать 350 kБ архивов. После данной операции, объём занятого дискового пространства возрастёт на 1 493 kB. Пол:1 http://mirror.mephi.ru/debian stretch/main amd64 php-gd amd64 2.5.0-1 [350 kB] Получено 350 kБ за 0с (2 266 kБ/c) Выбор ранее не выбранного пакета php-gd. (Чтение базы данных … на данный момент установлено 61175 файлов и каталогов.) Подготовка к распаковке …/php-gd_2.5.0-1_amd64.deb … Распаковывается php-xdebug (2.5.0-1) … Настраивается пакет php-xdebug (2.5.0-1) … После установки нам нужно перезапустить apache (эти примеры я показываю от пользователя root):
root@lnxdsk:~# service apache2 restart

Либо php-fpm, смотря, что используете Вы:

root@lnxdsk:~# service php7.0-fpm restart

Чтобы посмотреть список модулей php, который прямо сейчас подключен, можно запустить:

lynx@lnxdsk:~$ php -m [PHP Modules] bcmath bz2 calendar Core ctype curl date dba dom ereg exif fileinfo filter ftp gd gettext hash iconv intl json libxml mbstring mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_pgsql pgsql Phar posix readline Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xdebug xml xmlreader xmlwriter Zend OPcache zip zlib [Zend Modules] Xdebug Zend OPcache

Nginx, Php-Fpm и что это вообще?

Что такое php-fpm и зачем он нужен более-менее посещаемым проектам? Какие неприятности несет в себе переход с apache на fpm? Какие проблемы решает реально, а какие — надуманно?

Читайте также:  Стек вызовов функции питон

Почему timeout для curl в php необходим

Использование cURL в PHP имеет свою не очень приятную особенность — вечная блокировка процесса

Угадайте самый медленный фреймворк. И это не Laravel

Есть распространенное мнение, что Laravel почти самый медленный фреймворк, что даже его название нужно читать медленно и только одним пользователем на 1 ядро CPU. Но к счастью, это не так

Curl в PHP

Curl — это библиотека для работы с URL. Она интегрирована во множество языков, в том числе и в PHP.

Сессии в PHP — часть первая для Чайников

Вводная статья о том, как использовать сессии в PHP

Источник

How to Install PHP Modules (CentOS 7)

PHP modules, or extensions, can greatly extend the core functionality of PHP. These modules are compiled libraries that can help you implement different methods to connect to other services without the need to «reinvent the wheel.» By enabling these modules, your PHP code can become more versatile and adaptable, allowing you to interact with things such as MySQL seamlessly. The focus of this article is to explain how you can enable these modules in a CentOS 7 server so that you can take your PHP code to the next level. This article implies that you have already installed PHP on your CentOS 7 server. However, if you have not done this yet, please look at our article: How to install PHP (CentOS 7).

How To Install PHP Modules In CentOS 7

Before getting started, you’ll need to log in to your server using SSH. If you’re not familiar with how to do this, or you find yourself really enjoying our articles, please take a moment and read through the following: Connecting to Your Server via SSH. Once you have connected to your server via SSH, you can move on with the installation. Like any other installable software in CentOS 7, you’ll be installing PHP modules using the «yum» package manager. The basic syntax to install modules is identical to installing other packages. Essentially it would be yum install. But what if you’re not sure what PHP modules you’d like to install? By using Yum, you can actually perform a search for different packages, in this case, PHP modules like so:

Читайте также:  Иконка меню html css

This will search for anything with «PHP-» in its name and display a list of matching packages on your monitor. This tells you what packages are available, but what if you need to know what they do? In this instance, you can either put your «Google-fu» to work, or you can use the yum info command with the following syntax:

For example, let’s pretend that you want to know more about the PHP-CLI module, you’d issue the following:

This would generate output similar to the following:

Installed Packages Name: PHP-CLI Arch: x86_64 Version: 5.3.3 Release : 48.el6_8 Size: 6.2 M Repo: installed From repo: updates Summary: Command-line interface for PHP URL: http://www.php.net/ License: PHP Description: The PHP-CLI package contains the command-line interface : executing PHP scripts, /usr/bin/PHP, and the CGI interface. 

As you can see, the test server that I am using already have this module installed. However, if I needed to install it, I would do so via the following command:

You can, of course install multiple modules at once by using the following syntax:

yum install package-one package-two package-three 

A practical example of this would be:

yum install php-cli php-fpm php php-punic 

How To View Current PHP Modules

When logged into your server via SSH, type in the following command

This will populate a list, like the following, showing you all the current PHP modules installed.

Repository information has been removed from the above example

How To Remove A PHP Module

After installing any PHP module, you, of course, will have the opportunity to delete them. To delete a PHP module, type the following command

Читайте также:  Compress zip in python

You can remove multiple PHP modules by typing all the names you wish to remove, for example:

A list of PHP modules will be listed for removal, and typing these commands will require a [Y/N] (yes or no) response via a prompt to complete in the end.

Now your PHP modules chosen to be removed are uninstalled.

Like most things, moderation is the key, and it is best only to install modules that you need. I hope that after reading this article, you now feel more comfortable installing PHP modules. If you’re interested in testing your server’s PHP processing, we have an article that you might enjoy, which covers that: How To Create A PHP Info Page.

Written by Michael Brower / June 22, 2017

Источник

Оцените статью