如何检查在Ubuntu Linux 12.04 LTS中启用/禁用了哪些PHP扩展? [英] How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS?

查看:157
本文介绍了如何检查在Ubuntu Linux 12.04 LTS中启用/禁用了哪些PHP扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地计算机上使用Ubuntu Linux 12.04 LTS.我很早以前就在计算机上安装了LAMP.现在,我想启用以下PHP扩展:

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:

  1. php_zip
  2. php_xml
  3. php_gd2

首先,我要检查是否启用了这些PHP扩展.我搜索了很多有关如何检查已安装/启用的PHP扩展的信息,但是每次我找到如何在Ubuntu Linux上安装这些扩展的信息.所以有人可以让我知道如何在Ubuntu Linux 12.04 LTS中检查已启用/已禁用的PHP扩展吗?预先感谢.

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.

推荐答案

检查已安装的php模块和软件包

除了运行

php -m

获取已安装的php 模块的列表,您可能会发现获取Ubuntu中当前已安装的php 软件包的列表很有帮助:

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:

sudo dpkg --get-selections | grep -v deinstall | grep php

这很有用,因为Ubuntu通过软件包使php 模块可用.

This is helpful since Ubuntu makes php modules available via packages.

然后您可以通过从可用的Ubuntu php 软件包中进行选择来安装所需的模块,您可以通过运行以下命令进行查看:

You can then install the needed modules by selecting from the available Ubuntu php packages, which you can view by running:

sudo apt-cache search php | grep "^php5-"

或者,对于Ubuntu 16.04及更高版本:

Or, for Ubuntu 16.04 and higher:

sudo apt-cache search php | grep "^php7"

正如您所提到的,在您可能需要的软件包的实际安装方面,有很多可用的信息,因此在这里我将不做详细介绍.

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.

已安装的模块可能已被禁用.在这种情况下,它在运行php -m时不会显示,但会显示在已安装的Ubuntu软件包列表中.

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.

可以通过php-common软件包中的php5enmod工具(在以后的发行版中为phpenmod)启用/禁用模块.

Modules can be enabled/disabled via the php5enmod tool (phpenmod on later distros) which is part of the php-common package.

Ubuntu 12.04:

已启用的模块在/etc/php5/conf.d

Ubuntu 12.04 :(使用PHP 5.4 +)

启用已安装的模块:

php5enmod <modulename>

禁用已安装的模块:

php5dismod <modulename>

Ubuntu 16.04(php7)及更高版本:

启用已安装的模块:

phpenmod <modulename>

禁用已安装的模块:

phpdismod <modulename>

重新加载Apache

请记住在启用/禁用后重新加载Apache2:

Remember to reload Apache2 after enabling/disabling:

service apache2 reload

这篇关于如何检查在Ubuntu Linux 12.04 LTS中启用/禁用了哪些PHP扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆