Get php installed extension

extension_loaded

The extension name. This parameter is case-insensitive.

You can see the names of various extensions by using phpinfo() or if you’re using the CGI or CLI version of PHP you can use the -m switch to list all available extensions:

$ php -m [PHP Modules] xml tokenizer standard sockets session posix pcre overload mysql mbstring ctype [Zend Modules]

Return Values

Returns true if the extension identified by extension is loaded, false otherwise.

Examples

Example #1 extension_loaded() example

See Also

  • get_loaded_extensions() — Returns an array with the names of all modules compiled and loaded
  • get_extension_funcs() — Returns an array with the names of the functions of a module
  • phpinfo() — Outputs information about PHP’s configuration
  • dl() — Loads a PHP extension at runtime
  • function_exists() — Return true if the given function has been defined

User Contributed Notes

  • PHP Options/Info Functions
    • assert_​options
    • assert
    • cli_​get_​process_​title
    • cli_​set_​process_​title
    • dl
    • extension_​loaded
    • gc_​collect_​cycles
    • gc_​disable
    • gc_​enable
    • gc_​enabled
    • gc_​mem_​caches
    • gc_​status
    • get_​cfg_​var
    • get_​current_​user
    • get_​defined_​constants
    • get_​extension_​funcs
    • get_​include_​path
    • get_​included_​files
    • get_​loaded_​extensions
    • get_​required_​files
    • get_​resources
    • getenv
    • getlastmod
    • getmygid
    • getmyinode
    • getmypid
    • getmyuid
    • getopt
    • getrusage
    • ini_​alter
    • ini_​get_​all
    • ini_​get
    • ini_​parse_​quantity
    • ini_​restore
    • ini_​set
    • memory_​get_​peak_​usage
    • memory_​get_​usage
    • memory_​reset_​peak_​usage
    • php_​ini_​loaded_​file
    • php_​ini_​scanned_​files
    • php_​sapi_​name
    • php_​uname
    • phpcredits
    • phpinfo
    • phpversion
    • putenv
    • set_​include_​path
    • set_​time_​limit
    • sys_​get_​temp_​dir
    • version_​compare
    • zend_​thread_​id
    • zend_​version
    • get_​magic_​quotes_​gpc
    • get_​magic_​quotes_​runtime
    • restore_​include_​path

    Источник

    How to List Compiled and Installed PHP Modules in Linux

    If you have installed a number of PHP extensions or modules on your Linux system and you trying to find out a particular PHP module has been installed or not, or you simply want to get a complete list of installed PHP extensions on your Linux system.

    In this article, we will show you how to list all installed or compiled PHP modules from Linux command line.

    How to List Compiled PHP Modules

    The general command is php -m , which will show you a list of all “compiled” PHP modules.

    apc bz2 calendar Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext gmp hash iconv json libxml mbstring mcrypt mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar readline Reflection session shmop SimpleXML sockets SPL sqlite3 standard tidy tokenizer wddx xml xmlreader xmlwriter xsl zip zlib

    You can search for a specific PHP module for instance php-ftp , using the grep command. Simply pipe the output from the above command to grep as shown (grep -i flag means ignore case distinctions, thus typing FTP instead of ftp should work).

    # php -m | grep -i ftp ftp 

    How to List Installed PHP Modules

    To list all PHP modules that you have installed via a package manager, use the appropriate command below, for your distribution.

    # yum list installed | grep -i php #RHEL/CentOS # dnf list installed | grep -i php #Fedora 22+ # dpkg --get-selections | grep -i php #Debian/Ubuntu
    php.x86_64 5.3.3-49.el6 @base php-cli.x86_64 5.3.3-49.el6 @base php-common.x86_64 5.3.3-49.el6 @base php-devel.x86_64 5.3.3-49.el6 @base php-gd.x86_64 5.3.3-49.el6 @base php-mbstring.x86_64 5.3.3-49.el6 @base php-mcrypt.x86_64 5.3.3-5.el6 @epel php-mysql.x86_64 5.3.3-49.el6 @base php-pdo.x86_64 5.3.3-49.el6 @base php-pear.noarch 1:1.9.4-5.el6 @base php-pecl-memcache.x86_64 3.0.5-4.el6 @base php-php-gettext.noarch 1.0.12-1.el6 @epel php-tidy.x86_64 5.3.3-49.el6 @base php-xml.x86_64 5.3.3-49.el6 @base

    In case you want to find one particular module, like before, use a pipe and the grep command as shown.

    # yum list installed | grep -i php-mbstring #RHEL/CentOS # dnf list installed | grep -i php-mbstring #Fedora 22+ # dpkg --get-selections | grep -i php-mbstring #Debian/Ubuntu

    To view all php command line options, run.

    You might also like to check out these following useful articles about PHP.

    That’s all! In this article, we’ve explained how to list installed (or compiled in) modules in PHP. Use the comment form below to ask any questions.

    Источник

    How to list all the loaded extensions by PHP

    PHP is a popular computer language used by thousands of web servers to run various web applications. It is an open-source distributed under the PHP license. The abbreviation PHP originally stands for Personal Home Page Tools also popularly known as Hypertext Preprocessor. The PHP infrastructure is installed on an estimated 82% of all web servers on the Internet. More than 200 million apps and websites developed with PHP are online. Over 5 million software developers use the programming language.

    It is a scripting language that runs on the server-side to be used to convert PHP coded text files into machine code by the web server when they are called up. It is platform-independent and can be used on any hardware.

    The first PHP interpreter was developed in 1995 by Rasmus Lerdorf, who is considered to be the inventor of PHP. Today PHP has modern semantics and is available in ready-made installation packages for many operating systems. An extensive object-oriented programming language has grown out of this, which is now available in version 8. Extensive information is available for PHP with the help of its broad community of programmers.

    PHP is not only to be regarded as a syntactic-formal programming language but also as a technical-strategic platform. Because when we talk about PHP today, we mean not only the PHP-typical syntax but also ready-made PHP installation packages (stacks) that are available for many systems; simple, partly symbiotic database connection and administration; widespread use by commercial web hosts, global infrastructure; diverse programming libraries available; possibility to use well-tested open source solutions; linking with professional IDE and development tools.

    Источник

    How to List Installed PHP Modules on Ubuntu Linux

    programming 3173456 640

    A few days ago, I upgraded from PHP 7.2 to PHP 7.3, and all related extensions were installed with PHP 7.2, supporting my WordPress websites and blogs. I wanted to upgrade only currently installed extensions that were in use with PHP 7.2.

    If you are in a similar situation, refer to the steps below.

    This brief tutorial shows students and new users how to list all compiled and installed PHP extensions on Ubuntu 16.04 | 18.04 and might also be workable on future Ubuntu versions. To list installed PHP extensions, follow the steps below:

    List PHP Compiled Extensions

    PHP / PHP-FPM has a list of all extensions that are compiled by default on Ubuntu. But not necessarily installed and in use. Extensions that are compiled with PHP installation are available to be used when necessary.

    With a standard PHP install, not every library is compiled and installed — so if some functions are not working, you should look at what PHP extensions are compiled and installed.

    So, to list compiled PHP / PHP-FPM extensions, run the commands below

    That should show you something similar to the list below:

    [PHP Modules] calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv igbinary imagick json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline redis Reflection session shmop SimpleXML sockets sodium SPL standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache

    List PHP Installed Extension

    Now, to find out what PHP / PHP-FPM extensions are installed, you run the commands below:

    dpkg --get-selections | grep -i php

    You should see a similar list below:

    php install php-common install php-igbinary install php-imagick install php-redis install php7.2-cli install php7.2-common install php7.2-curl install php7.2-fpm install php7.2-gd install php7.2-json install php7.2-mbstring install php7.2-mysql install php7.2-opcache install php7.2-readline install php7.2-tidy install php7.2-xml install php7.2-xmlrpc install php7.2-zip install

    That’s how you know which extensions are installed

    So if you only want to install PHP 7.3 extensions of what is currently installed with PHP 7.2, use the commands above to list installed PHP extensions, then install those PHP 7.3 versions.

    Congratulations! You have learned how to list PHP extensions to determine which are compiled and installed.

    You may also like the post below:

    Richard

    I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

    Источник

    How to list all installed PHP extensions

    Many times, web hosting owners are asking if a specific PHP extension is installed on the server or not. You can check easily with a simple PHP script. We will mainly use the get_loaded_extensions PHP function to get the list of the extensions.

    Just create a new php file – phpextensions.php – with the following content and open it in your preferred web browser:

    '; // lists all PHP extensions foreach (get_loaded_extensions() as $i => $ext) < echo $ext .' =>'. phpversion($ext). '
    '; > ?>

    On a test server the result is:

    Current PHP version: 8.0.3 Core => 8.0.3 date => 8.0.3 libxml => 8.0.3 openssl => 8.0.3 pcre => 8.0.3 sqlite3 => 8.0.3 zlib => 8.0.3 bcmath => 8.0.3 calendar => 8.0.3 ctype => 8.0.3 curl => 8.0.3 dom => 20031129 hash => 8.0.3 fileinfo => 8.0.3 filter => 8.0.3 ftp => 8.0.3 gd => 8.0.3 gettext => 8.0.3 SPL => 8.0.3 iconv => 8.0.3 intl => 8.0.3 json => 8.0.3 mbstring => 8.0.3 session => 8.0.3 standard => 8.0.3 mysqlnd => mysqlnd 8.0.3 PDO => 8.0.3 pdo_mysql => 8.0.3 pdo_sqlite => 8.0.3 Phar => 8.0.3 posix => 8.0.3 Reflection => 8.0.3 mysqli => 8.0.3 SimpleXML => 8.0.3 soap => 8.0.3 sockets => 8.0.3 sodium => 8.0.3 exif => 8.0.3 tokenizer => 8.0.3 xml => 8.0.3 xmlreader => 8.0.3 xmlwriter => 8.0.3 xsl => 8.0.3 zip => 1.19.2 cgi-fcgi => 8.0.3 imagick => 3.4.4 imap => 8.0.3 Zend OPcache => 8.0.3

    Источник

    Читайте также:  Наибольший общий делитель алгоритм питон
Оцените статью