- Установка PHP расширений на Linux
- Установка расширений через панель ISPmanager
- Коротко о pecl
- Установка расширений через apt, yum и pecl
- mcrypt
- How to enable core PHP extension in Linux?
- 3 Answers 3
- Not the answer you’re looking for? Browse other questions tagged php linux lamp or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- How to Enable the PHP 5 Apache MySQL Extensions on Ubuntu Linux Easy Guide
- Enabling PHP MySQL Extensions on Apache for Ubuntu 14.04 Trusty
- How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS?
- 6 Answers 6
- Checking for installed php modules and packages
- Related: Enabling / disabling installed php modules
- Enable Extensions for PHP on Centos 7
- 3 Answers 3
- Not the answer you’re looking for? Browse other questions tagged php module or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
Установка PHP расширений на Linux
Расширения php используют, когда требуется расширить набор функций для работы PHP-скриптов на сервере. Каждое расширение имеет узкую функциональность и способно серьезно облегчить и ускорить выполнение конкретных задач, связанных с php-кодом. В панель ISPmanager уже интегрированы популярные решения и часто достаточно только включить нужное. Но бывает и так, что для работы сайта или его компонентов необходимы другие расширения — и тут без установки вручную не обойтись.
Список практически всех доступных расширений есть на официальном сайте php.
Установленных версий php на сервере может быть несколько. Нативная версия PHP — версия из официального репозитория ОС. Дополнительно можно установить альтернативные версии. Это иногда необходимо, если для работы проекта требуется определенная версия php, которой нет в официальном репозитории.
Ниже мы рассмотрим несколько вариантов установки расширений php:
- через панель управления ISPmanager. Большинство расширений уже установлено и подключено, но есть те, которые можно дополнительно установить или просто подключить.
- через стандартные пакетные менеджеры yum (CentOS) и apt (Ubuntu/Debian) для нативной версии php.
- через репозиторий модулей pecl — подойдёт как для нативной, так и для альтернативной версии php.
Дополнительно расскажем о том, как подключить расширения в консоли.
Установка расширений через панель ISPmanager
Для начала нужно определить, на какой версии работает наш сайт. Для этого переходим в раздел Домены — WWW-домены , выбираем нужный домен и смотрим последний столбец Версия PHP :
После этого переходим в раздел Настройки web-сервера — PHP , выбираем нужную версию php, расширения:
Далее воспользуемся поиском в верхнем правом углу — вводим туда название расширения. Если оно найдено, выбираем его. По необходимости устанавливаем и включаем:
Коротко о pecl
Прежде чем перейти к установке расширений с помощью пакетных менеджеров и альтернативного репозитория модулей, пару слов скажем о том, с какими ситуациями вы можете столкнуться во время работы с pecl. Ниже будут описаны некоторые из них:
Пример 1. Представим, что у нас две версии php:
Нативная (native) — /usr/bin/php
Альтернативная (alt) — /opt/php73/bin/php — альтернативная версия php 7.3 в панели ISPmanager.
Чтобы установить расширения php, для нативной и альтернативной версии необходимо использовать разные команды.
Для нативной версии:
Для альтернативной, php 7.3, так:
Поэтому важно помнить — необходимо указывать полный путь к бинарному файлу pecl. Ниже будут указаны команды установки, без полного пути, так как они могут отличаться, вам нужно иметь это ввиду.
Пример 2. Если вы используете не самую свежую версию php, то во время установки расширения можете получить сообщение о ее несоответствии требованиям — по умолчанию выбираются расширения последних версий, которые часто требуют свежих версий php. Пример уведомления:
В уведомлении указано, что версия php должна быть не ниже 7.0.0 и не выше 7.1.0, а мы пытаемся установить расширение на версию 5.6.40.
Чтобы понять, какая версия расширения нужна для установки на имеющуюся версию php (в данном случае 5.6.40), обратимся за помощью на официальный сайт. Ищем нужное расширение, переходим на его страницу:
Переходим в список изменений:
Находим в списке изменений, что последней версией расширения, поддерживающей php ниже 7 версии, является redis 2.2.8:
Из этого следует, что для установки нам нужно указать redis-2.2.8, например так (не забудьте поставить знак — между названием расширения и его версией):
Важно!
После установки любого из расширений нужно перезапускать apache2/httpd или php-fpm. Также не забудьте проверить, подключилось ли расширение:
О том, как установить популярное расширение ioncube, читайте в нашей инструкции
Установка расширений через apt, yum и pecl
Ниже описаны установки расширений для всех версий php — от установки зависимостей до подключения. Описание разделено на версию ОС и версию php: нативную (native) или альтернативную (alt). Будьте внимательны при установке расширений для альтернативной версии через pecl.
mcrypt
Во время установки на вопрос “libmcrypt prefix? [autodetect]” жмём Enter.
Источник
How to enable core PHP extension in Linux?
I’m trying to understand the process for enabling an a core extension (dom) in php. When I run phpinfo, I see ‘—disable-dom’ in the configure command. Am I supposed to re-install PHP?
3 Answers 3
Yes, you need to recompile PHP. Rerun ./configure with the appropriate parameter (probably —enable-dom , but I’m not sure on the param)
You might be able to install it from your distributions repository. If not download your php versions source, extract it from the tarball. cd to the directory php/ext and look for a dom folder, cd into that and type phpize then make && make install that will install a dynamic extension for you which you can enable via extension=.so in your php.ini
Use this command to install the dom extension.
and wait for the success message. After which reboot your Amazon instance, which would solve the problem.
Not the answer you’re looking for? Browse other questions tagged php linux lamp or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
How to Enable the PHP 5 Apache MySQL Extensions on Ubuntu Linux Easy Guide
Enabling PHP MySQL Extensions on Apache for Ubuntu 14.04 Trusty
You are Welcome! The Tutorial Shows You Step-by-Step How to Install and Enable the PHP 5 Apache 2 MySQL Extensions on Ubuntu 14.04 Trusty Tahr LTS i386/amd64 Linux Server/Desktop.
The PHP MySQL Extension dispose of 3 API’s:
It is recommended to use either the mysqli or PDO_MySQL extensions. It is not recommended to use the old mysql extension for new development, as it has been deprecated as of PHP 5.5.0 and will be removed in the future.
The mysqli, PDO_MySQL and mysql PHP extensions are lightweight wrappers on top of a C client library.
Login into Server Shell.
Or Open a Command Line Terminal Window
(Press “Enter” to Execute Commands)
Ctrl+Alt+t
How to Install the PHP 5 MySQL Extension.
How to Install Netbeans IDE for PHP Development on Ubuntu
Enabling the PHP5 Apache MySQL Extensions
- For mysql Extension:
- For mysqli Extension:
- For PDO_MySQL Extension:
Ctrl+x to Save & Exit from nano Editor 🙂
Install Aptana Studio 3 IDE for Html5, Javascript, CSS, PHP:
Restart the Apache Web Server
Источник
How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS?
I’m using Ubuntu Linux 12.04 LTS on my local machine. I’ve installed LAMP long ago on my machine. Now I want to enable following PHP extensions:
For it first I want to check whether these PHP extensions are enabled or not. I searched a lot about how to check the installed/enabled PHP extensions but every time I found how to install these extensions on Ubuntu Linux. So can someone please let me know how should I check the enabled/disabled PHP extensions in Ubuntu Linux 12.04 LTS? Thanks in advance.
6 Answers 6
Checking for installed php modules and packages
In addition to running
to get the list of installed php modules, you will probably find it helpful to get the list of the currently installed php packages in Ubuntu:
This is helpful since Ubuntu makes php modules available via packages.
You can then install the needed modules by selecting from the available Ubuntu php packages, which you can view by running:
Or, for Ubuntu 16.04 and higher:
As you have mentioned, there is plenty of information available on the actual installation of the packages that you might require, so I won’t go into detail about that here.
Related: Enabling / disabling installed php modules
It is possible that an installed module has been disabled. In that case, it won’t show up when running php -m , but it will show up in the list of installed Ubuntu packages.
Modules can be enabled/disabled via the php5enmod tool ( phpenmod on later distros) which is part of the php-common package.
Ubuntu 12.04:
Enabled modules are symlinked in /etc/php5/conf.d
Ubuntu 12.04: (with PHP 5.4+)
To enable an installed module:
To disable an installed module:
Ubuntu 16.04 (php7) and higher:
To enable an installed module:
To disable an installed module:
Reload Apache
Remember to reload Apache2 after enabling/disabling:
Источник
Enable Extensions for PHP on Centos 7
I want to run Drupal using Ngnix, but once I’ve installed ngnix, drupal, I see this:
I have php script that shows these modules aren’t loaded:
The Output looks like this:
even though «php -m» shows the modules are available to the command line interface:
. How can I make them available to the web server?
3 Answers 3
Assuming you are using a Virtual Machine from Google, Running Centos 7:
Find the php extensions, for instance:
Find the php.ini:
Edit php.ini and change extension_dir directive:
Had the same issue, this is what worked for me.
service php-fpm restart
Might need to do service php72-fpm restart depending on version.
You can run ps -ef | grep php to try to understand the service name based on the processes that are running.
The solution that worked for me was to install Open SUSE
Then install the php application #zyyper-log | grep php 2019-12-24 13:40 449 1.14.33 zypper install php7 2020-03-25 16:19 10705 1.14.33 zypper install php7 php7-mysql apache2-mod_php7 2020-03-31 11:26 26810 1.14.33 zypper install php7-zlib 2020-03-31 13:32 30329 1.14.33 zypper install php7-gd
Not the answer you’re looking for? Browse other questions tagged php module or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник